I'm deploying a Django app to a dev server and am hitting this error when i run pip install requirements.txt:
Traceback (most recent call last):
File "/var/www/mydir/virtualenvs/dev/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
pkg_resources appears to be distributed with setuptools. Initially I thought this might not be installed to the python in the virtualenv so I installed setuptools (2.6, same version as Python) to the Python site-packages in the virtualenv with the following command
sh setuptools-0.6c11-py2.6.egg --install-dir /var/www/mydir/virtualenvs/dev/lib/python2.6/site-packages
EDIT This only happens inside the virtualenv. If I open a console outside the virtualenv then pkg_resources is present
but I am still getting the same error. Any ideas as to why pkg_resources is not on the path?
If you are using Python 3, you should use pip3 instead of pip. The command looks like
$ pip3 install requirements.txt
I have seen this error while trying to install rhodecode to a virtualenv on ubuntu 13.10. For me the solution was to run
before I run easy_install rhodecode.
Looks like they have moved away from bitbucket and are now on github (https://github.com/pypa/setuptools)
Command to run is:
None of the posted answers worked for me, so I reinstalled pip and it worked!
(reference: http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/)
If you are encountering this issue with an application installed via conda, the solution (as stated in this bug report) is simply to install setup-tools with:
I have had the same problem when I used easy-install to install pip for python 2.7.14. For me the solution was (might not be the best, but worked for me, and this is probably the simplest) that the folder that contained the
easy-install.py
also contained a folderpkg_resources
, and i have copy-pasted this folder into the same folder where mypip-script.py
script was (python27\Scripts
). Since then, I found it in thepython27\Lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor
folder as well, it might be a better solution to modify thepip-script.py
file to import this.