Virtualenv requirements not detected

On Windows XP, I used virtualenvwrapper-win to create a virtualenv, and pip install and easy_install to install a bunch of packages.  At that point, my python code runs just fine from the command line.  

I set up PyCharm to use that virtualenv, but my code wouldn't run from PyCharm b/c it can't find the right packages.  So I manually added <pathtovirtualenv>\lib\site-packages to the list of paths for my virtualenv.  Now my code runs, but PyCharm still doesn't detect the installed packages, so I get the "Package requirements missing" yellow bar at the top of all my files.

What's going on here?
Could you please show a screenshot of the "Paths" tab of the interpreter settings for your virtualenv?
I must be missing something obvious... how is this supposed to work?

The behavior I'm seeing with PyCharm is consistent with what would happen if it ran [myvirtualenv]\Scripts\python.exe without first running [myvirtualenv]\Scripts\activate.bat to set up the environment.  Is that the intended functionality?
Turns out I had a PYTHONHOME environment variable set to the "global" python directory.  That prevents Python from using its own exe path to look for site-packages and instead looks back in the main path.  Deleting the PYTHONHOME environment variable and restarting PyCharm fixed these problems.

Please sign in to leave a comment.