Reputation: 816
Python3.5 does not locate installed modules when invoked in virtual env.
python3.5 -m venv autogit/venv && cd autogit
source venv/bin/activate
which python
== ...autogit/venv/bin/python
Weird, would expect python3.5/autogit
and pip freeze>requirements.txt
pip install -r requirements.txt
ls venv/lib/python3.5/site-packages
shows request-0-0-0-py3.5.egg-info
and some other stuffwhich python
revealed python rather than python3.5
, lets invoke the python3.5binary explicitly.... venv/bin/python3.5 autogit.py
Get ImportError: No module named 'request
??? Where could python be looking for packages if not in my virtual env?
UPDATE The questions above remain unanswered; here are things I noticed since then and the workaround I used:
pip install
produced a file request-0-0-0-py3.5.egg-info
. It did NOT produce an actual request
directory with the source code or binaries for this module. Also why is it version 0 0 0 that is fishy
After some googling I noticed the module I wanted seemed to be named requests
not request
which is what was in my source. I changed it requests, pip install
, and everything works. It was hard to see that there was a mistake because pip install
ing request
did not fail
Upvotes: 2
Views: 1186
Reputation: 4242
Have you got other Python versions installed? That might be the problem.
Try using pip3
instead of pip
Upvotes: 1