• Register
0 votes
919 views

Problem :

In the MacOS Mojave terminal I am trying to install a python package with pip. At the end of it says as follows :

You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Here I wanted to upgrade the pip with the given command but I got an error as follows:

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.

I am confused now and don’t know what to do.Also I just realized that  it says Python 2.7 in the error message but I have python 3 and want to use only python 3.

6 5 3
7,540 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

For any project which is in python it is highly recommended to work on a Virtual enviroment, is a tool that will help you to keep dependencies required by different projects separate by creating the isolated python virtual environments for them.

In order to create one with the python3+ you must use the following command:

virtualenv enviroment_name -p python3

And after that you can work on it just by activating it as follows:

source enviroment_name/bin/activate

Once your virtual environment is activated, the name of your virtual environment will appear on left side of your terminal. This will confirm that the virtual environment is currently active. Now you can install the dependencies related to your project in this virtual environment by just using pip. As follows:

pip install package_name
9 7 4
38,600 points
0 votes

Solution:

In case you want to employ python3+ to install the packages you require to use pip3 install packageName

And to solve the errno 13 you have to include --user at the end

pip3 install packageName --user

EDIT:

For any project in python it's immensely recommended to perform on a Virtual enviroment, is a tool that helps to keep dependencies necessary by diverse projects separate by making isolated python virtual environments for them.

In order to make one with python3+ you have to employ the following command:

virtualenv enviroment_name -p python3

And then you perform on it only by activating it:

source enviroment_name/bin/activate

At one time the virtual environment is activated, the name of your virtual environment will seem on left side of terminal. This will let you know that the virtual environment is presently active. At present you can install dependencies related to the project in this virtual environment by only employing pip.

pip install package_name

Concerning the permissions command, attempt employing sudo in front of your terminal command:

sudo pip install --upgrade pip

Sudo is a program that approves you to run the command with the privileges of the superuser.

Regarding the python attempt running pip as an executable like this:

python3.6 -m pip install <package>

I obtain the similar error at the time I was attempting to install a package (flask-classful).
I created the mistake of installing anaconda as root. I altered the ownership of the installed anaconda folder and I could install the package successfully.

Employ the command chown with option -R to recursively alter ownership of the installed anaconda folder like so:

chown -R owner:group /path/to/anaconda

The answer is in the error message. In the former you or a process did a sudo pip and that happened some of the directories under /Library/Python/2.7/site-packages/... to have permissions that make it unaccessable to your immddiate user.

Thereafter you did a pip install whatever which dependencies on the other thing.

Or you can employ pip install's --user option to install packages into your home directory where you have all necessary permissions. For example

pip install myPackage --user

Do not forget to include the install directory in your home to PATH environment variable.

10 6 4
31,120 points

Related questions

0 votes
1 answer 1.5K views
1.5K views
Problem : I am using windows 10. I also have Tensorflow on my box.It says "Hello Tensorflow!" to me. However it has all of below before it: 2019-12-05 18:16:01.500579: I T:\src\github\tensorflow\tensorflow\core\platform\ ... \numpy\\.libs\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll' Consider using the--useroption or check the permissions. Any solution on this issue?
asked Dec 7, 2019 alecxe 7.5k points
0 votes
1 answer 1 view
1 view
Problem: How to repair could not set boot device property: 0xe00002bc?
asked 1 day ago Humaira ahmed 15.3k points
0 votes
1 answer 6 views
6 views
Problem: Mac apt-get command not found.
asked Mar 22 Dan phillip 4.8k points
0 votes
1 answer 7 views
7 views
Problem: it outputs: sudo: apt-get: command not found I have no idea why this is the case. How can I resolve this so I am following the tutorial correctly?
asked Mar 22 ummesalma 25.2k points
0 votes
1 answer 29 views
29 views
Problem : npm Warning : you must install peer dependencies yourself.
asked Feb 27 Shovo210 14k points
0 votes
1 answer 2K views
2K views
Problem : I am very new to Quartz. So whenever I try to install Quartz on my system using pip install Quartz, I face the following error. Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> ... [Errno 2] No such file or directory: 'requirements.txt' I am using Mac OSX with Anaconda. Does anyone have any clue on this issue?
asked Nov 27, 2019 alecxe 7.5k points
1 vote
1 answer 1 view
1 view
Problem : I have Python 2.7.10 in a macOS High Sierra version 13.10.5 .I've been trying to install astropy and at the end of the installation I get this message: Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine ... files belong to it which would lead to only a partial uninstall. I have tried: pip uninstall numpy and then I get the same message.
asked 2 hours ago Shovo210 14k points
0 votes
1 answer 33 views
33 views
Problem: How to fix this error: socket.error: [errno 13] permission denie HELP! I need help understanding this error: socket.error: [errno 13] permission denied Can someone please help fix this, I am new in python() : python plot line with slope and intercept
asked Mar 1 Mashhoodch 13k points
1 vote
1 answer 24 views
24 views
Problem: I was trying to handle the input-output function to open a file through my python program. You may call it an experiment because I am a new learner of Python. Once I tried to open a file from my computer, it produces an error IOError: [errno 13] permission ... wrong. Here is the python script I wrote open(r'C:\Users\****\Desktop\TestFile') I am waiting to read your solutions. Thanks.
asked Jun 16, 2020 adamSw 11.3k points
0 votes
2 answers 3 views
3 views
Problem: I'm used to using Macports to install all the Unixy stuff. However, I'm finding that most of the python modules I install with it are not being seen by python.
asked Mar 31 Jack20 3k points