5

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

Community
  • 1
  • 1
McLawrence
  • 3,560
  • 5
  • 31
  • 44
  • 1
    What are the file permissions of `/Users//anaconda/lib/python3.5/` and `/Users//anaconda/lib/python3.5/site-å/` ? – zimmerrol Apr 28 '17 at 13:55
  • I have got `drwx` right for the `.../python3.5/site-packages` folder but somehow the `easy-install.pth` is the only file in this folder where I just got `rw` permissions. – McLawrence Apr 28 '17 at 14:09
  • Try to execute `chmod +x easy-install.pth` to get exectuve permissions. It is normal that the the `d` permission is missing for the `.pth` file, as it is a file and not a directory. – zimmerrol Apr 28 '17 at 14:16
  • 1
    I think that you might have run some `sudo` command in the past which mixed the owner of the file, too. Try to change the owner from `sudo` to your own user account and check if the error is solved. – zimmerrol Apr 28 '17 at 14:24
  • That solved it. – McLawrence Apr 28 '17 at 14:44

1 Answers1

2

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.

zimmerrol
  • 4,436
  • 2
  • 17
  • 36