Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied with trying to use pip on MAC?

Tags:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/beautifulsoup4-4.6.0.dist-info'Consider using the `--user` option or check the permissions.

The error above is the one I get when I try to use the pip command. All I need to do is pip install the requirements.txt to get my program to work. I have python 2.7.1 installed and placed my code where I am able to use python commands. I tried to change permissions by using this command:

chmod -R 777

but it did not work. I have homebrew installed on my computer. I also tried to use a virtual environment using this link: http://sourabhbajaj.com/mac-setup/Python/virtualenv.html but it gave me permission issues as well. Is there any suggestions to get rid of this permissions issue and run pip successfully? The sudo command below also doesn't work.

sudo pip install -r requirements.txt
like image 373
Sam Avatar asked May 07 '18 00:05

Sam


People also ask

Why does pip command not work Mac?

Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.

Why can't I use pip install?

This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem. The easiest way is via the Python executable installer.


2 Answers

This is a permissions issue.

Consider using pip install "packagename" --user as mentioned in the error. This is covered HERE

like image 102
Aidan Ross Avatar answered Sep 18 '22 08:09

Aidan Ross


try using sudo pip install djangorestframework for Mac. Worked for me.

like image 27
Beni Avatar answered Sep 22 '22 08:09

Beni