"permissionerror: [errno 13] Permission Denied: '/usr/lib/python3.5/site-packages'" Installing Django
Solution 1:
You could accidentally recreate virtualenv with Python2 by forgetting to put path to Python3 interpreter so when you execute pip3 it refers to system Python3.
Make sure that you use correct Python in your virtualenv and also make sure that you create virtualenv with pip (yes it's the default option but we don't know how you create your virtual environment).
Solution 2:
Just to expand on the answer by @valentjedi, here's how I got my permission issue fixed without using sudo.
Install
Make sure you have virtualenv installed here
This is optional, but I also use virtualenvwrapper to use the
workon
command here, otherwise you can justsource bin/activate
from the virtualenv
Create Virtualenv
You do not want to install your project libraries with sudo
because it will install your libraries system wide (which will run into issues when you have more than one project). Instead use virtualenvs like this:
$mkvirtualenv myenv --python=python3.5
$workon myenv
$pip3 install -r requirements.txt
This gets you setup by making your virtualenv 'myenv' and specifying which python you are using. You then activate the environment and are able to install your requirements file.
Solution 3:
I had the same issue even though I had correct python path in my virtualenv. My mistake though was to use wrong pip version - having python3.7 I was typing pip install -r requirements.txt instead of pip3.7 install -r requirements.txt
Solution 4:
I was getting the same error
copying build/lib.linux-x86_64-3.8/pvectorc.cpython-38-x86_64-linux-gnu.so -> /home/insoluble/Workspace/venvs/your_venv/lib/python3.8/site-packages
byte-compiling /home/insoluble/Workspace/venvs/your_venvlib/python3.8/site-packages/_pyrsistent_version.py to _pyrsistent_version.cpython-38.pyc
error: [Errno 13] Permission denied: '/home/insoluble/Workspace/venvs/your_venv/lib/python3.8/site-packages/__pycache__/_pyrsistent_version.cpython-38.pyc.140572841931152'
Make sure you don't use sudo
while creating a virtual environment. I did that mistake while creating one, hence the problem.
After creating a fresh environment using following command, It solved the problem.
python3.8 -m venv ~/Workspace/venvs/my_venv
Post a Comment for ""permissionerror: [errno 13] Permission Denied: '/usr/lib/python3.5/site-packages'" Installing Django"