. Advertisement .
..3..
. Advertisement .
..4..
There might be instances when you keep getting an error “Could not install packages due to an EnvironmentError: [Errno 13] Permission denied” when you pip install. This error comes up because of missing privilege to the directory in which pip is trying to write files. In this blog, we will run through some of the ways you can fix that error and get back on track.
What is “Could not install packages due to an EnvironmentError: [Errno 13] Permission denied”?
You are trying to utilize the pip command to install Python packages, but you can get the following error.
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied:
'/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/EGG-INFO/PKG-INFO'
Consider using the `--user` option or check the permissions.
How to fix the error?
Here are some solutions for you. Take a look and choose the method that is suitable for you.
Option 1: Include –user at the end
Simply include –user to the end of your command. Just utilize the following command.
pip3 install package_name --user
Option 2: Change of ownership
go to /Library/Python/2.7/site-packages/
… find the folder with root or elevated permissions and rm -rf yourpackages
, then use chown -R … or chmod -R … to reinstall packages with your user, or just force ownership there for the user they should to have access:
chown -R owner:group /path/to/anaconda
Option 3: Update pip
All you have to do now is update pip, and your problem will be resolved.
sudo pip install --upgrade pip
Use the following command to run pip as an executable:
python3.6 -m pip install <package>
Option 4: Utilize Environment
Simply make isolated virtual Python environments. To build one with Python 3+, run the command below.
virtualenv enviroment_name -p python3
After that, activate it.
source enviroment_name/bin/activate
You may now utilize pip to install project-related dependencies in the virtual environment.
pip install package_name
Conclusion
We hope you enjoyed our blog post on how to solve the bug “Could not install packages due to an EnvironmentError: [Errno 13] Permission denied”. Please leave a comment if you have any further questions or concerns regarding this topic. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!
Similar errors:
→ Solving the error “PermissionError: [Errno 13] Permission denied”
Leave a comment