Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PermissionError with pip3

This is the error when I try to get anything with pip3 I'm not sure what to do

Exception: Traceback (most recent call last):   File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main     status = self.run(options, args)   File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run     requirement_set.install(install_options, global_options, root=options.root_path)   File "/usr/lib/python3/dist-packages/pip/req.py", line 1435, in install     requirement.install(install_options, global_options, *args, **kwargs)   File "/usr/lib/python3/dist-packages/pip/req.py", line 671, in install     self.move_wheel_files(self.source_dir, root=root)   File "/usr/lib/python3/dist-packages/pip/req.py", line 901, in move_wheel_files     pycompile=self.pycompile,   File "/usr/lib/python3/dist-packages/pip/wheel.py", line 206, in move_wheel_files     clobber(source, lib_dir, True)   File "/usr/lib/python3/dist-packages/pip/wheel.py", line 193, in clobber     os.makedirs(destsubdir)   File "/usr/lib/python3.4/os.py", line 237, in makedirs     mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-                        packages/Django-1.7.2.dist-info'  Storing debug log for failure in /home/omega/.pip/pip.log 
like image 945
Meghdeep Ray Avatar asked Jan 08 '15 21:01

Meghdeep Ray


People also ask

Can I have both pip and pip3?

Using Different Versions of pip If you have installed Python2 and Python3 on your computer, you should be able to use pip2 and pip3 in addition to using the pip command. Pip can be set up to work on either Python2 or Python3 on one machine. It will not work with both.

Is Python3 pip the same as pip3?

We can see that pip is just a soft link to the current active Python version and related pip command. But the Python3 becomes the default Python version for most of the Linux distributions the pip and pip3 refer to the same command and executable these days.

Should I use pip3 or pip?

You have to use pip3 for it to be installed on Python3. So to install packages in python3, you should use pip3. NOTE:- Its not necessary that pip will install in python 2.7, if python2 is absent then pip will do it in python3. The above statement was if you have both the version of python installed.

How do I fix permission error in Python?

We can solve this error by Providing the right permissions to the file using chown or chmod commands and also ensuring Python is running in the elevated mode permission .


Video Answer


2 Answers

just install them using --user option which install the package only for the current user and not for all

pip install xxxxxx --user 
like image 137
Seeni Avatar answered Sep 22 '22 04:09

Seeni


You need to use sudo to install globally or have permissions to write to the folder. Or as @Alasdair commented using a virtualenv is a better option.

like image 38
Padraic Cunningham Avatar answered Sep 26 '22 04:09

Padraic Cunningham