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


Márk Mészáros
Márk Mészáros
2,966 Points

Problem with importing peewee

Dear people!

I was doing the diary.py exercise, but when I wanted to run the code, I got the following message, but only in my PowerShell (in workspaces it works fine):

Traceback (most recent call last): File "diary.py", line 7, in <module> from peewee import * ModuleNotFoundError: No module named 'peewee'

I tried than to install peewee in PowerShell, but pip install peewee but that gave an error as well. I tried to install peewee with pip3, than it said it does not know pip3. Than I tried easy_install peewee, that gave no error, but running the diary.py code still gave the same error, no module named peewee...

Seems like the problem is that peewee is not properly installed, and there are other issues with installing it.

Any ideas anybody? Thanks in advance ;)

1 Answer

When working in Windows either Command Prompt or Powershell you can only pip install things when Command/Powershell is run as Admin.

On that note though. You really should be using the *virtualenv package then you only pip install virtualenv in a Command/Powershell running as admin. Then from then on you can run Command/Powershell (not as admin) but you will need to "activate" your virtual environment. Once its activated, you can pip install anything into THAT environment.

This basically creates little Python environments for pip installing things. That way you can have multiple environments, each one running different versions of different packages if you need.

Check out the Virtualenv docs and you can Google/Youtube around for articles if you are completely confused about how to use environments. But the main reason you get errors in Windows during a pip install is because you arent running as admin.