3

Basically, the title. I want to upgrade pip because I cannot get new packages in python because it is obsolete.

When I try to run pip3 install --upgrade pip from the Ubuntu terminal, this happens:

    Collecting pip
  Using cached pip-9.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/marcell/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/pip'
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

How should I solve this problem? I tried to purge pip and reinstall it,but to no avail.

Edit: Also, tried the upgrade command with pip too, but it didn't seem to work.

3

2 Answers 2

4

I have two solutions to your problem

  1. Try using sudo as stated in above answer.

    sudo pip3 install --upgrade pip

  2. Try to do fresh reinstall of pip

    apt-get remove python3-pip

    pip3 install -U pip

NOTE: This can be done for python2x ,by replace pip3 by pip2

0
3
  • Try:

    sudo pip3 install --upgrade pip
    

"Permission denied" errors are usually solved by adding "sudo" to your commands.

(sudo is just a keyword to execute a given command with privileges)

  • If you get a "command not found" then you should do the following:

Type Python into your command console, it will tell you which version of Python you are using.

C:/>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32

If you have Python 3.x you should use pip3, if you have Python 2.x you should use pip.

If you are using the right pip but still get the "command not found" then you have to install pip:

For Python2.x:

sudo apt-get install python-pip

For Python 3.x:

sudo apt-get install python3-pip
3
  • I tried that too, but for some reason it doesn't find pip3: sudo: pip3: command not found Mar 26, 2018 at 11:24
  • simply try pip, pip3 is used the OP might have both python2x and python3x . So, to just upgrade the pip of python3 pip3 is used Mar 26, 2018 at 11:44
  • I edited the answer to answer you @marcell-fekete. Hope it helps pal! Mar 27, 2018 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.