• Register
0 votes
343 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

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 566 views
566 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.2K views
1.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 16 views
16 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 adamSw 11.3k points
0 votes
1 answer 12 views
12 views
Problem: I have recently started learning python. Now to do practical on python I am trying to install the python onto my homebrew. Python got downloaded and after that the error message popped up at the end of installation and it stopped it from completing. If I try to ... sudo chown -R $(whoami) /usr/local And nowI get the error message which reads as: chown: /usr/local: Operation not permitted
asked Jul 28 Raphael Pacheco 4.9k points
0 votes
1 answer 80 views
80 views
Problem : I want to intstall the TensorFlow using pip. I tried below command: $ pip install tensorflow &ndash;user But I got below error: Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow How can I install the TensorFlow?
asked Feb 19 mphil 2.3k points