0
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/user/Library/Python/3.8/lib'
Check the permissions.

I use pip3 install --user --upgrade tensorflow.

Why Is't work... Somebody help me pls..

yeon
  • 11
  • Seems it gives an error because you don't have a permission – jacobkim Jul 26 '21 at 04:59
  • pip does not recommend using sudo. There are many comments telling you to put --user when you don't have permission. – yeon Jul 27 '21 at 05:06
  • The error occurred due to an issue with mac m1. Thanks for the comment. – yeon Jul 27 '21 at 05:06
  • Does this answer your question? [pip install failing with: OSError: \[Errno 13\] Permission denied on directory](https://stackoverflow.com/questions/31512422/pip-install-failing-with-oserror-errno-13-permission-denied-on-directory) – jacobkim Jul 27 '21 at 07:44

1 Answers1

0

I probably meet the same problem.

pip3 install lxml

Result:

Defaulting to user installation because normal site-packages is not writeable
Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB)
Installing collected packages: lxml
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/username/Library/Python/3.8'
Check the permissions.

Mostly of answers tell us to add --user

pip3 install lxml --user

Result:

Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB)
Installing collected packages: lxml
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/username/Library/Python/3.8'
Check the permissions.

I don't want to use sudo to install package

sudo pip3 install lxml

I can't install then use virtualenv

virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt

I found only Python on path '/Users/username/Library/' be owned by root,

...
drwxr-xr-x    5 username  staff    160  6 29  2015 PubSub
drwx------    3 root      staff     96  3  6  2019 Python
drwxr-xr-x@   4 username  staff    128 10 21  2020 Reminders
drwxr-xr-x   37 username  staff   1184  8 19 23:03 Safari
drwxr-xr-x@   2 username  staff     64  3 12  2018 SafariSafeBrowsing
...

I decided to use chown, problem solved.

sudo chown -R $USER  /Users/username/Library/Python

I had no idea what time dose Python folder be owned by root.

ZALin
  • 1