Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flask run error running Python 3.6.4 on the flask team project #7

Open
ainsleymcgrath opened this issue Mar 16, 2018 · 1 comment
Open

Comments

@ainsleymcgrath
Copy link

Here's the error I get when running flask run after installing all the requirements and setting up a venv.

`(venv)

ainsleymcgrath @ MacBook-Pro in ~/Documents/dev/tso/CodingWorkshops/problems/webdev/flask_team_project on git:master x [19:15:22] C:1

$ flask run
Traceback (most recent call last):
File "/usr/local/bin/flask", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 478, in main
cli.main(args=args, prog_name=name)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 345, in main
return AppGroup.main(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 388, in run_command
app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 124, in init
self._load_unlocked()
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 148, in _load_unlocked
self._app = rv = self.loader()
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 209, in load_app
rv = locate_app(self.app_import_path)
File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 89, in locate_app
import(module)
File "/Users/ainsleymcgrath/Documents/dev/tso/CodingWorkshops/problems/webdev/flask_team_project/app.py", line 2, in
from flask_debugtoolbar import DebugToolbarExtension
ModuleNotFoundError: No module named 'flask_debugtoolbar'`

After this, I tried omitting all references to flask-debugtoolbar I got a similar error.

$ flask run Traceback (most recent call last): File "/usr/local/bin/flask", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 478, in main cli.main(args=args, prog_name=name) File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 345, in main return AppGroup.main(self, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func return ctx.invoke(f, obj, *args[1:], **kwargs) File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 388, in run_command app = DispatchingApp(info.load_app, use_eager_loading=eager_loading) File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 124, in __init__ self._load_unlocked() File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 148, in _load_unlocked self._app = rv = self.loader() File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 209, in load_app rv = locate_app(self.app_import_path) File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 89, in locate_app __import__(module) File "/Users/ainsleymcgrath/Documents/dev/tso/CodingWorkshops/problems/webdev/flask_team_project/app.py", line 6, in <module> import meetup.api ModuleNotFoundError: No module named 'meetup' (venv)

My Python was installed using homebrew, and other than that I don't think there's anything notable about my setup.

@tathagata
Copy link
Contributor

Hey @aiiins thanks a lot for taking time to report the issue.
I tried the steps on 3.6.1, and was not able to reproduce the issue.
My guess is your flask command is to pointing to a different script from a previous installation of flask that was probably done without creating a virtual environment. So when you run flask run, it is still points to the previous one. Try this

$ which flask

For the flask run command to work it should point to the flask script inside the venv/bin/ folder, where venv is the directory created once you did python -m venv venv.
For example, in my machine

 (venv) t (7) flask_team_project $ which flask 
 /Users/t/CodingWorkshops/problems/webdev/flask_team_project/venv/bin/flask

Try running this instead, and see if you are getting expected result

(venv) t (7) venv/bin/flask run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants