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 Using Databases in Python Meet Peewee Meet Peewee, Our ORM

David Ton-Lai
David Ton-Lai
3,268 Points

Peewee won't install

I can't get peewee to install using the command 'pip install peewee' in my terminal on Mac.

Davids-MacBook-Air:Library david-ton-lai$ pip install peewee
Collecting peewee
  Using cached peewee-2.9.0.tar.gz
Installing collected packages: peewee
  Running setup.py install for peewee ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pz/s8t3v4yj4cz8rd8t_llx5gh80000gn/T/pip-build-DDeMpe/peewee/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/pz/s8t3v4yj4cz8rd8t_llx5gh80000gn/T/pip-vDzKAI-record/install-record.txt --single-version-externally-managed --compile:
    /private/var/folders/pz/s8t3v4yj4cz8rd8t_llx5gh80000gn/T/pip-build-DDeMpe/peewee/setup.py:23: UserWarning: Cython C extensions for peewee will NOT be built, because Cython does not seem to be installed. To enable Cython C extensions, install Cython >=0.22.1.
      'extensions, install Cython >=' + cython_min_version + '.')
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying peewee.py -> build/lib
    copying pwiz.py -> build/lib
    creating build/lib/playhouse
    copying playhouse/__init__.py -> build/lib/playhouse
    copying playhouse/apsw_ext.py -> build/lib/playhouse
    copying playhouse/berkeleydb.py -> build/lib/playhouse
    copying playhouse/csv_loader.py -> build/lib/playhouse
    copying playhouse/csv_utils.py -> build/lib/playhouse
    copying playhouse/dataset.py -> build/lib/playhouse
    copying playhouse/db_url.py -> build/lib/playhouse
    copying playhouse/djpeewee.py -> build/lib/playhouse
    copying playhouse/fields.py -> build/lib/playhouse
    copying playhouse/flask_utils.py -> build/lib/playhouse
    copying playhouse/gfk.py -> build/lib/playhouse
    copying playhouse/hybrid.py -> build/lib/playhouse
    copying playhouse/kv.py -> build/lib/playhouse
    copying playhouse/migrate.py -> build/lib/playhouse
    copying playhouse/pool.py -> build/lib/playhouse
    copying playhouse/postgres_ext.py -> build/lib/playhouse
    copying playhouse/read_slave.py -> build/lib/playhouse
    copying playhouse/reflection.py -> build/lib/playhouse
    copying playhouse/shortcuts.py -> build/lib/playhouse
    copying playhouse/signals.py -> build/lib/playhouse
    copying playhouse/sqlcipher_ext.py -> build/lib/playhouse
    copying playhouse/sqlite_ext.py -> build/lib/playhouse
    copying playhouse/sqlite_udf.py -> build/lib/playhouse
    copying playhouse/sqliteq.py -> build/lib/playhouse
    copying playhouse/test_utils.py -> build/lib/playhouse
    running build_scripts
    creating build/scripts-2.7
    copying and adjusting pwiz.py -> build/scripts-2.7
    copying and adjusting playhouse/pskel -> build/scripts-2.7
    changing mode of build/scripts-2.7/pwiz.py from 644 to 755
    changing mode of build/scripts-2.7/pskel from 644 to 755
    running install_lib
    copying build/lib/peewee.py -> /Library/Python/2.7/site-packages
    error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/peewee.py'

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

This the error that I'm getting.

1 Answer

Brian McKinney
Brian McKinney
10,119 Points

This is because you are trying to install Peewee to a global directory that you do not have permission to modify. If you'd like to install peewee globally like this, you can use a sudo command to do so.

sudo pip install peewee

This will prompt you to authenticate before allowing you to override the permissions issues.

In practice, you will rarely install packages like peewee globally in this manner, you will use a virtual env to create various development environments. However, for learning purposes installing this globally works just fine.

David Ton-Lai
David Ton-Lai
3,268 Points

Thanks for the help Brian! I ended up doing sudo pip3 install peewee because it was only installing for older versions of Python on my computer!