Flask: Command 'flask' not installed and can't run from module

Created on 15 Dec 2014  Â·  2Comments  Â·  Source: pallets/flask

When attempting to follow the docs, I can't run any example applications because the 'flask' command-line tool doesn't get installed.

Here's the full sequence of events using a virtualenv:

discovery:~/dev/flasktest% virtualenv .venv
New python executable in .venv/bin/python
Installing setuptools, pip...done.

discovery:~/dev/flasktest% . .venv/bin/activate

discovery:~/dev/flasktest% pip install Flask

discovery:~/dev/flasktest% flask
zsh: command not found: flask

discovery:~/dev/flasktest% ls .venv/bin
activate         activate.fish    easy_install     pip              pip2.7           python2
activate.csh     activate_this.py easy_install-2.7 pip2             python           python2.7

Additionally, when I try using the alternative method in the documentation via python -m flask, I get the following:

discovery:~/dev/flasktest% python -m flask -a hello run --debug
/Users/bc/dev/flasktest/.venv/bin/python: No module named flask.__main__; 'flask' is a package and cannot be directly executed

According to the docs, though, this was only a problem with Python <2.7, and I'm running with 2.7.8:

discovery:~/dev/flasktest% python --version
Python 2.7.8

discovery:~/dev/flasktest% pip --version
pip 1.5.6 from /Users/bc/dev/flasktest/.venv/lib/python2.7/site-packages (python 2.7)

discovery:~/dev/flasktest% pip freeze
Flask==0.10.1
Jinja2==2.7.3
MarkupSafe==0.23
Werkzeug==0.9.6
itsdangerous==0.24
wsgiref==0.1.2

How should I run my Flask app?

Most helpful comment

You seem to be reading the dev docs but using the latest release. Use pip install https://github.com/mitsuhiko/flask/tarball/master to install the latest code to try out. Before that, no command line tool was built in, so you needed to write your own command or use something like Flask-Script.

All 2 comments

You seem to be reading the dev docs but using the latest release. Use pip install https://github.com/mitsuhiko/flask/tarball/master to install the latest code to try out. Before that, no command line tool was built in, so you needed to write your own command or use something like Flask-Script.

Thanks very much — all is good now.

Was this page helpful?
0 / 5 - 0 ratings