Reputation: 6775
I'm trying to follow the following tutorial http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world#commentform
I seem to be very lost. First of all from what I understand. Running the command 'python virtualenv.py flask' creates a virtual python environment inside the folder 'flask'. Is this correct?
Second, doesn't this mean that if I cd to this folder and then run 'pip install flask' that it should install flask to that folder? When I run any of these pip install commands, my terminal fills up with crazy madness which I don't understand.
Benjamins-MacBook:flask test$ pip install flask==0.9
Downloading/unpacking flask==0.9
Downloading Flask-0.9.tar.gz (481kB): 481kB downloaded
Running setup.py egg_info for package flask
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking Werkzeug>=0.7 (from flask==0.9)
Downloading Werkzeug-0.9.4.tar.gz (1.1MB): 1.1MB downloaded
Running setup.py egg_info for package Werkzeug
warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
Downloading/unpacking Jinja2>=2.4 (from flask==0.9)
Downloading Jinja2-2.7.1.tar.gz (377kB): 377kB downloaded
Running setup.py egg_info for package Jinja2
warning: no files found matching '*' under directory 'custom_fixers'
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
Downloading/unpacking markupsafe (from Jinja2>=2.4->flask==0.9)
Downloading MarkupSafe-0.18.tar.gz
Running setup.py egg_info for package markupsafe
Installing collected packages: flask, Werkzeug, Jinja2, markupsafe
Running setup.py install for flask
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
error: could not create '/Library/Python/2.7/site-packages/flask': Permission denied
Complete output from command /usr/bin/python -c "import setuptools;__file__='/private/var/folders/9l/6fgb2st97cs2b2jkj7g4bs5m0000gp/T/pip_build_test/flask/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9l/6fgb2st97cs2b2jkj7g4bs5m0000gp/T/pip-PbWDVv-record/install-record.txt --single-version-externally-managed:
Any idea what I'm doing wrong?
Upvotes: 3
Views: 7410
Reputation: 502
Error says: error: could not create '/Library/Python/2.7/site-packages/flask': Permission denied
which means you need root permissions to install flask. Try sudo pip install flask==0.9
Upvotes: 0
Reputation: 3009
You need to source the bin/activate
script first in the new flask folder to activate the virtualenv.
If you are running bash
(most likely) then run:
cd new/flask/directory
. bin/activate
pip install ...
When you want to get out of the virtualenv, you can quit the terminal tab, or run:
deactivate
Note that when you activate a virtualenv, it only is active in the one terminal tab you are in.
If you don't run that command first, then pip
will try to install into your system directories, thus giving the permission errors you are seeing.
Upvotes: 7
Reputation: 1371
The virtualenv has to be activated before after creating it.
Change to the virtualenv directory you just created and source the activation script from the bin directory:
$ source flask/bin/activate
Also, have a look at the first answer here: Warnings and errors after trying to install Flask 0.9
Upvotes: 0