0

When trying to update python3's (freshly re-installed using homebrew) pip, a non-existing directory /Users/me/Library/Python/2.7/site-packages/pip/__init__.py is accessed. It seems to me that there might be some left-over configuration that I need to remove. How could I fix this?

python3 -m pip install --upgrade pip 
Collecting pip
  Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.3.1
    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
  Rolling back uninstall of pip
  Moving to /usr/local/lib/python3.7/site-packages/pip
   from /usr/local/lib/python3.7/site-packages/~ip
  Moving to /usr/local/lib/python3.7/site-packages/pip-19.3.1-py3.7.egg-info
   from /usr/local/lib/python3.7/site-packages/~ip-19.3.1-py3.7.egg-info
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Users/me/Library/Python/2.7/site-packages/pip/__init__.py'
Consider using the `--user` option or check the permissions.

Interestingly, using sudo does not result in an error but still does not provide the expected results (in that it installs to /Users/user/Developer/bin for some reason):

sudo python3 -m pip install --upgrade pip --user
Password:
WARNING: The directory '/Users/robert/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/robert/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 1.5MB/s 
Installing collected packages: pip
  WARNING: The scripts pip, pip3 and pip3.7 are installed in '/Users/user/Developer/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.0.2
rodalfus
  • 166
  • 2
  • 14
  • Have you tried its suggestion of using the `user` flag....? `python3 -m pip install --upgrade pip --user` – KJTHoward Mar 09 '20 at 22:14
  • https://stackoverflow.com/search?q=%5Bpip%5D+upgrade+pip+Errno+13+Permission+denied – phd Mar 09 '20 at 22:16
  • @KJTHoward Yes, the error stays the same (except of course for the suggestion being removed). – rodalfus Mar 09 '20 at 22:16
  • @phd Those answers are not helpful: in my case I am using *pip3* but it accesses the *Python2.7* directory. – rodalfus Mar 09 '20 at 22:20

0 Answers0