• Register
0 votes
588 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 929 views
929 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
1 vote
1 answer 19 views
19 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
1 answer 1.6K views
1.6K 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
0 votes
1 answer 34 views
34 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, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 21 views
21 views
I am struggling with Jetson TX2 board (aarch64). I need to install python wrapper for OpenCV. I can do: $ sudo apt-get install python-opencv But I cannot do: $ sudo pip install opencv-python Is this because there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv ? Is there a way to install opencv-python through pip?
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 409 views
409 views
Problem : When I executed: pip install xgboost I got this: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/w4/w49s3mn91plbhyjwf8qjkpxc0000gn/T/pip-build-61dms1/xgboost/
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
1 answer 131 views
131 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, 2020 mphil 2.3k points
0 votes
1 answer 137 views
137 views
Problem : When I try to install PyGame with:pip install pygame i am getting below error python could not find a version that satisfies the requirement
asked Oct 22, 2019 peterlaw 6.9k points
2 votes
1 answer 2.5K views
2.5K views
Problem: When I try to run the below command on my command prompt: python get-pip.py It shows the following message: C:\Users\ASUS>python get-pip.py python: can't open file 'get-pip.py': [Errno 2] No such file or directory How can I have pip installed in my system. Then why am I getting this error message and why I can not open this file. Thanks in advance.
asked May 6, 2020 samhaz 5k points
0 votes
1 answer 12 views
12 views
This is the error I get (mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install mysql-python Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded Running setup.py egg_info for package mysql-python sh: mysql_config: not found ... egg_info failed with error code 1 Storing complete log in /home/zjm1126/.pip/pip.log What can I do to resolve this?
asked Oct 24, 2020 psandprop 2.4k points