Rutger Huijsmans
Rutger Huijsmans

Reputation: 2408

Installing Flask using Pip

I'm a first timer to Python and I'm trying to set up an easy quick backend with it. When trying to install Flask using Pip I run this and see the following error:

Rutgers-MacBook-Pro:~ rutger$ pip install flask
Collecting flask
  Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
    100% |████████████████████████████████| 81kB 1.3MB/s
Collecting itsdangerous>=0.21 (from flask)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 3.4MB/s
Collecting click>=2.0 (from flask)
  Downloading click-6.6.tar.gz (283kB)
    100% |████████████████████████████████| 286kB 1.5MB/s
Collecting Werkzeug>=0.7 (from flask)
  Downloading Werkzeug-0.11.10-py2.py3-none-any.whl (306kB)
    100% |████████████████████████████████| 307kB 1.7MB/s
Collecting Jinja2>=2.4 (from flask)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 2.7MB/s
Collecting MarkupSafe (from Jinja2>=2.4->flask)
  Downloading MarkupSafe-0.23.tar.gz
Installing collected packages: itsdangerous, click, Werkzeug, MarkupSafe, Jinja2, flask
  Running setup.py install for itsdangerous ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-l5geyj-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying itsdangerous.py -> build/lib
    running install_lib
    copying build/lib/itsdangerous.py -> /Library/Python/2.7/site-packages
    error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous.py'

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-l5geyj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/15/tb28c0s930gf3k_7wxp56ckw0000gn/T/pip-build-X1QvJq/itsdangerous/

I also see I've 2 versions of Python:

Rutgers-MacBook-Pro:~ rutger$ py
pydoc             pydoc2.6          python            python2           python2.6         python2.7         pythonw           pythonw2.6
pydoc2            pydoc2.7          python-config     python2-config    python2.6-

Running 2.7 though:

Rutgers-MacBook-Pro:~ rutger$ python --version
Python 2.7.10

Upvotes: 1

Views: 3463

Answers (1)

satoru
satoru

Reputation: 33215

As you can see in the output, the error is

error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous.py'

You can try again with sudo pip install flask which lets you run the original command as the root user.

Upvotes: 3

Related Questions