close

[Solved] pip install failing with: OS: [Errno 13] Permission denied on directory

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error pip install failing with: OS: [Errno 13] Permission denied on directory in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How pip install failing with: OS: [Errno 13] Permission denied on directory Error Occurs?

Today I get the following error ip install failing with: OS: [Errno 13] Permission denied on directory in python.

How To Solve pip install failing with: OS: [Errno 13] Permission denied on directory Error ?

  1. How To Solve pip install failing with: OS: [Errno 13] Permission denied on directory Error ?

    To Solve ip install failing with: OS: [Errno 13] Permission denied on directory Error Rather than using sudo with pip install, It's better to first try pip install --user. If this fails then take a look at the top post here.

  2. pip install failing with: OS: [Errno 13] Permission denied on directory

    To Solve ip install failing with: OS: [Errno 13] Permission denied on directory Error Rather than using sudo with pip install, It's better to first try pip install --user. If this fails then take a look at the top post here.

Solution 1

Rather than using sudo with pip install, It’s better to first try pip install --user. If this fails then take a look at the top post here.

The reason you shouldn’t use sudo is as follows:

When you run pip with sudo, you are running arbitrary Python code from the Internet as a root user, which is quite a big security risk. If someone puts up a malicious project on PyPI and you install it, you give an attacker root access to your machine.

Solution 2

Option a) Create a virtualenv, activate it and install:

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

Option b) Install in your homedir:

pip install --user -r requirements.txt

My recommendation use safe (a) option, so that requirements of this project do not interfere with other projects requirements.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read