Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

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

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,610 Points

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.