Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Character Builder Items

Dean McKenzie
Dean McKenzie
11,149 Points

Console for this task does not seem to be working. Keep getting an import error for flask.

Whilst doing the flask video I am unable to run my program due to an import error. Now this did work yesterday however it is not working today, could somebody from the Treehouse team please advise?

treehouse:~/workspace$ python app.py
Traceback (most recent call last):
File "app.py", line 2, in <module>
from flask import (flask, render_template, redirect,
ImportError: No module named flask

Kind Regards

7 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

Taylor, it seems the PATH environment is not correct on Workspaces. python is pointing at python2 not python3.

The short-term workaround is to use python3 app.py

Josh Keenan
Josh Keenan
20,315 Points

Simple enough I think, try this.

from flask import Flask, redirect, render_template
Dean McKenzie
Dean McKenzie
11,149 Points

Hi Josh tried changing the Flask from lower case to upper case and it has not made a difference. Thanks for your prompt help though.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,454 Points

Taylor, are you saying you are still getting the exact same error "ImportError: No module named flask" (note lowercase f) after you change your import statement to use upper-cased Flask?

Josh Keenan
Josh Keenan
20,315 Points

I get it Chris, on any flask project in my workspaces that have no problems..

Chris Freeman
Chris Freeman
Treehouse Moderator 68,454 Points

Right. It's complaining about the from flask module missing not the import f/Flask attribute. If it were due to import f/Flask you would have seen a different error:

ImportError: cannot import name....

Josh Keenan
Josh Keenan
20,315 Points

Okay, will have a look at it myself

Josh Keenan
Josh Keenan
20,315 Points

Can you post all your code as well

Josh Keenan
Josh Keenan
20,315 Points

Okay my flask projects that I haven't worked on in a while won't run either.. :S

Presuming they are updating something or other!

Dean McKenzie
Dean McKenzie
11,149 Points

Not sure if the full code will help in this circumstance as it seems to be a direct Flask import problem. I think your right they maybe doing some sort of upgrade , or have some of outage.

Again thanks for taking the time to look into and answer my question.

Enjoy your evening.

Dean McKenzie
Dean McKenzie
11,149 Points

Thanks Chris that works, who do I speak to in order to get this permanently rectified as I would like to complete this course within the next couple of days.

Thanks Again for you support.

Dean McKenzie
Dean McKenzie
11,149 Points

Thanks Chris I can confirm that my program is now running.