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 Our Diary App Doing Data Entry

Brienna Herold
Brienna Herold
5,155 Points

No module named peewee

diary.py runs when I type in the terminal

Briennas-MacBook:Programming Brienna$ python diary.py
Briennas-MacBook:Programming Brienna$ 

but not when I type in

Briennas-MacBook:Programming Brienna$ python3 diary.py
Traceback (most recent call last):
  File "diary.py", line 8, in <module>
    from peewee import * 
ImportError: No module named 'peewee'

Does this mean I need to re-install peewee...? Does it not work with python3 or something?

8 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

If you have python3, you probably have pip3, too. Install Peewee with that and try it again.

Anthony Attard
Anthony Attard
43,915 Points

I think you have ran pip install peewee(python2). For python3 use pip3 install peewee.

Shana HT
Shana HT
3,292 Points

I ran into the same issue.

I followed the instructions on the site I link below to install and run with git.

http://docs.peewee-orm.com/en/latest/peewee/installation.html

These are the commands:

git clone https://github.com/coleifer/peewee.git cd peewee python3 setup.py install

Have you installed pewee are you using virtual env?

Brienna Herold
Brienna Herold
5,155 Points

Yes, I installed peewee. It works with python 2 but not python 3. I would like to know why.

Timothy Clarke
Timothy Clarke
11,710 Points

I'm running into this same issue using python 3 and I used pip3 to install peewee. I've been searching for the solution and I think it may have something to do with the directory that pip3 is saving to, but I have no idea how to redirect it.

t19clar ~ $ pip3 install peewee Requirement already satisfied (use --upgrade to upgrade): peewee in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-package

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Did you try following the instructions pip3 gave you? In other words, did you do pip3 install --upgrade peewee?

dear Kenneth .. i did install peewee using pip3 and this shows :

ARTISANVs-MacBook-Pro:lib artisanv$ pip3 install peeweepip3 install peewee Collecting peeweepip3 Could not find a version that satisfies the requirement peeweepip3 (from versions: ) No matching distribution found for peeweepip3 You are using pip version 8.0.2, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. ARTISANVs-MacBook-Pro:lib artisanv$ pip install --upgrade pip Requirement already up-to-date: pip in ./python2.7/site-packages ARTISANVs-MacBook-Pro:lib artisanv$

i have both python2 and 3 ...my peewee projects wowrk fine with py2 but not 3 .....

any advice ???

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You'll have better luck withpip3 install peewee. Not sure where you got the extra pip3 from.

I don't know if anyone else is still having issues with this, but I also got the "No module named 'peewee' error.

When I try pip3 install peewee I get: PS C:\Users\melsr\Documents\Python_TechDegree> pip3 install peewee
Requirement already satisfied: peewee in c:\users\melsr\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (3.13.3)

So it is definitely installed, but it is not being recognized when I try to run my code. I am using VS Code if that makes any difference ¯(°_o)/¯