Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'pkg_resources'

I tried to upgrade tensorflow with pip install tensorflow --upgrade. During the uninstallation of the old version of setuptools some error occurred:

PermissionError: [Errno 13] Permission denied: '/Users/<myName>/anaconda/lib/python3.5/site-packages/easy-install.pth'

and

FileNotFoundError: [Errno 2] No such file or directory: '/Users/<myName>/anaconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg'

Now, when using pip, I get the error that there is No module named 'pkg_resources'.

I tried the solution in the thread No module named pkg_resources:

Using

curl https://bootstrap.pypa.io/ez_setup.py | python

again produced the following error (also when using sudo curl):

error: [Errno 13] Permission denied: '/Users/<myName>/anaconda/lib/python3.5/site-packages/easy-install.pth'

Trying to reinstall setuptools as was also suggested:

pip install --upgrade setuptools

results in the same No module named 'pkg_resources' error message.

I am using MacOS 10.12.4

like image 531
McLawrence Avatar asked Oct 29 '22 08:10

McLawrence


1 Answers

At first: you should always watch out when you execute any command via sudo - this might really screw your file permissions up. As it seems, this is exactly what has happened here. Your user account has to take over the permissions of the easy-install.pth. Try to execute

sudo chown myuser easy-install.pth
chmod +x easy-install.pth

Then continue with the

curl https://bootstrap.pypa.io/ez_setup.py | python

command to fix your No module named 'pkg_resources' problem. Now your pip should be working again. Afterwards try to upgrade tensorflow again with pip install tensorflow --upgrade and check if this has solved your problem.

like image 65
zimmerrol Avatar answered Nov 15 '22 05:11

zimmerrol