Parsifal
Parsifal

Reputation: 342

Trying to upgrade pip by the cmd with no results

Hi I'm using spyder and I want to upgrade pip (my actual pip version is 9.0.3).

I've tried to do this by the cmd typing:

python -m pip install --upgrade pip

but I get an error which says:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Requirement already up-to-date: pip in c:\program files\python36\lib\site-packages
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

I also tryed to upgrade pip with this code (setting a different proxy - 'cause of my company laptop has firewall) typing this:

python -m pip install --upgrade pip --proxy="http://user:[email protected]:portnumber"

but once again I'm getting an error:

Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst' -> 'C:\\Users\\indelicl\\AppData\\Local\\Temp\\pip-7kqirkkb-uninstall\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\Program Files\Python36\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\Program Files\Python36\lib\shutil.py", line 559, in move
    os.unlink(src)
PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

How can I do this?

Upvotes: 0

Views: 403

Answers (1)

Quillan Kaseman
Quillan Kaseman

Reputation: 98

The exception messages contain the information you are looking for.

PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst' -> 'C:\\Users\\indelicl\\AppData\\Local\\Temp\\pip-7kqirkkb-uninstall\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'

This indicates you don't have sufficient permissions to edit the pip files. Specifically the PermissionError exception type and the Accesso negato (Permission denied) error message.

In order to resolve this, you need to either run your command with sudo (on Linux systems) or run the command as an Administrator (on Windows).

It appears you are on Windows so you should be able to right click on the Command Prompt icon and click "Run as administrator" and run the command from the elevated shell. It is worth mentioning that you should not do this by default, you should only run with elevated permissions when you know it is necessary (as it is in this case).

Upvotes: 1

Related Questions