16

What is the problem? I tried "python -m pip install -U pip" and "python -m pip install --upgrade pip" both with the same error (and "pip install -U --force-reinstall pip"). what should I do?

C:\Users\Peyman\PycharmProjects\untitled3>python -m pip install -U pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\wheel.py", line 462, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\_vendor\distlib\scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\_vendor\distlib\scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\_vendor\distlib\scripts.py", line 212, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\Peyman\AppData\Roaming\Python\Python35\site-packages\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
You are using pip version 9.0.3, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

4 Answers 4

35

Try using easy_install -U pip, according to this bug report.

Edit: Okay, go to "https://pypi.org/simple/pip/", and download the latest .whl file (scroll to the bottom). When you have it, open cmd in the same folder (by clicking File -> open powershell/cmd in the file explorer), and type

pip install filename, with filename being the name of the file you downloaded (Should be pip-18.0-py2.py3-none-any.whl).

Try that and tell me if it works.

3
  • 3
    I can run "python -m easy_install -U pip" and successfully upgrade pip. I found after the installation, pip.exe is upgraded (pip -V shows the new version), but "python -m pip -V" still shows the old version. Anyway it works for me!
    – robbie fan
    Apr 16, 2019 at 1:35
  • 1
    first tried downloading the *whl file but it didn't work, but then the easy_installmethod worked
    – Oshada
    Aug 26, 2019 at 8:52
  • That happily solves the problem for pip version 19.2.1 to 19.2.3 (python 3.7.4). Aug 27, 2019 at 19:29
22

You can try this following:

python -m pip install -U --force-reinstall pip
1
  • simple great solution
    – Hara
    Mar 11, 2022 at 8:14
7

My answer is a variation of assmmahmud's but for me I had to use the option --user. I'm on windows so from CMD.exe;

py -m pip install --user --force-reinstall -U

If I don't use the --user option then the error occurs.

1

Download get-pip.py from the official site and run this code:

$ python get-pip.py

or on Windows, this one:

py get-pip.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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