Reputation: 8710
I am migrating from python2 to python3.
I created a virtualenv with python3 -m venv py3
and am trying to pip install -r requirements.txt
but it says
Collecting mock==1.0.1 (from -r requirements.txt (line 8))
Using cached mock-1.0.1.tar.gz
setuptools must be installed to install from a source distribution
I checked my virtualenv and it does have setuptools:
(py3) 1111:d3 1111$ ls py3/lib/python3.4/site-packages/
__pycache__ easy_install.py pip-6.0.8.dist-info setuptools
_markerlib pip pkg_resources setuptools-12.0.5.dist-info
but when I still try to reinstall setuptools it says
(py3) 1111:d3 1111$ pip install setuptools
Requirement already satisfied (use --upgrade to upgrade): setuptools in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
So I have 2 questions:
Thanks!
Upvotes: 9
Views: 7156
Reputation: 371
This one worked for me:
pip install --upgrade pip
pip install setuptools
Upvotes: 2
Reputation: 1312
I found the above recreating a virtualenv to not work. However I destroyed my virtualenv, and then upgraded pip and virtualenv and this issue resolved itself.
pip install -U virtualenv
pip install -U pip
Upvotes: 1
Reputation: 26679
In my case it helped to install setuptools
under pip
user:
pip install -U pip setuptools
Upvotes: 4
Reputation: 2384
You can simply do
cp /usr/bin/python2 /path/to/my-virtualenv/bin/python2 or
cp /usr/bin/python3 /path/to/my-virtualenv/bin/python3
For me, it solved a similar problem.
Upvotes: 0
Reputation: 215
This is not an answer to your questions, but for me it was easier to reinstall the virtual environment than trying to solve the issue. After setting up a new virtualenv, I had no problem installing or updating packages again.
Upvotes: 9