seomoz / shovel

Rake, for Python
MIT License
660 stars 49 forks source link

Shovel can't find modules inside virtual environment #45

Closed robedthomas closed 5 years ago

robedthomas commented 5 years ago

I am encountering a problem where shovel tasks fail to import modules installed specifically inside a Python virtual environment (Python 3.5.0), even though the virtual environment is activated.

When I attempt to import such a module, I get an ImportError:

ImportError: no module named 'pyupdate'

Going into the Python console, I'm able to import the module without issue:

>>> import pyupdate
>>>

I check the the venv's site-packages folder, and verify that pyupdate is in fact a folder there.

I even check the sys path to ensure that the path to the venv's site-packages is correct, and sure enough it is.

>>> import sys
>>> sys.path
[(lots of unimportant stuff), 'base_dir/venv/lib/site-packages']

import_module is a cheap work around, but if the imported libraries contain any of their own imports to other modules in the venv, then the same problem is encountered, so this obviously isn't maintainable.

I'm working with Python 3.5.0, on Windows 10. Let me know if any more details would be helpful.

robedthomas commented 5 years ago

Nevermind, I figured it out. The problem was that shovel was installed outside of the virtual environment, so it only had reference to the non-venv modules.

Now I can close this issue in record time!