Pip: Document Windows 10 update solution

Created on 17 Jun 2020  路  17Comments  路  Source: pypa/pip

Environment

  • pip version: 20.0.1
  • Python version: 3.7.6
  • OS: Windows 10

Description

I am trying to upgrade pip and while rolling back the uninstall of pip, it runs into an exception telling me that it can't find t64.exe in pip._vendor.distlib. I'm presuming that it means "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib". I checked that folder and found t64.exe there.
Expected behavior

Pip should upgrade without any errors and should be able to notice t64.exe.
How to Reproduce

1.Open command prompt in admin mode

  1. type 'python -m pip install --upgrade pip'

Output

C:\WINDOWS\system32>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.1
    Uninstalling pip-20.0.1:
      Successfully uninstalled pip-20.0.1
  Rolling back uninstall of pip
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip3.7.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip3.7.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip3.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip3.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\site-packages\pip-20.0.1.dist-info\
   from c:\users\jeffr\appdata\roaming\python\python37\site-packages\~ip-20.0.1.dist-info
  Moving to c:\users\jeffr\appdata\roaming\python\python37\site-packages\pip\
   from c:\users\jeffr\appdata\roaming\python\python37\site-packages\~ip
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
    status = self.run(options, args)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 404, in run
    use_user_site=options.use_user_site,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 71, in install_given_reqs
    **kwargs
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 815, in install
    warn_script_location=warn_script_location,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 614, in install_wheel
    warn_script_location=warn_script_location,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 548, in install_unpacked_wheel
    generated_console_scripts = maker.make_multiple(scripts_to_generate)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 415, in make_multiple
    filenames.extend(self.make(specification, options))
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 280, in make
    return super(PipScriptMaker, self).make(specification, options)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 404, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 304, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 239, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 383, in _get_launcher
    raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
WARNING: You are using pip version 20.0.1; however, version 20.1.1 is available.
You should consider upgrading via the 'C:\ProgramData\Anaconda3\python.exe -m pip install --upgrade pip' command.
windows docs support

Most helpful comment

Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip

All 17 comments

I believe you might have a typo in the distlib path you shared in the issue (pip\_vendor instead of pip_vendor).

Also may I ask if the suggested command in the error message of upgrading through Anaconda via 'C:\ProgramData\Anaconda3\python.exe -m pip install --upgrade pip' works?

Related:
https://bitbucket.org/pypa/distlib/issues/123/attributeerror-nonetype-object-has-no

6546

I believe there was an upgrade to the vendored distlib in https://github.com/pypa/pip/pull/7618 where this particular error was addressed and changed to ValueError (https://bitbucket.org/pypa/distlib/commits/305a20488486d3c0f3cba4c6810442140ed2848e)

Any luck with this error

Environment

  • pip version: 20.0.1
  • Python version: 3.7.6
  • OS: Windows 10

Description

I am trying to upgrade pip and while rolling back the uninstall of pip, it runs into an exception telling me that it can't find t64.exe in pip._vendor.distlib. I'm presuming that it means "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packagespip_vendordistlib". I checked that folder and found t64.exe there.
Expected behavior

Pip should upgrade without any errors and should be able to notice t64.exe.
How to Reproduce

1.Open command prompt in admin mode

  1. type 'python -m pip install --upgrade pip'

Output

C:\WINDOWS\system32>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.1
    Uninstalling pip-20.0.1:
      Successfully uninstalled pip-20.0.1
  Rolling back uninstall of pip
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip3.7.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip3.7.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\scripts\pip3.exe
   from C:\Users\jeffr\AppData\Local\Temp\pip-uninstall-6f_5wl4x\pip3.exe
  Moving to c:\users\jeffr\appdata\roaming\python\python37\site-packages\pip-20.0.1.dist-info\
   from c:\users\jeffr\appdata\roaming\python\python37\site-packages\~ip-20.0.1.dist-info
  Moving to c:\users\jeffr\appdata\roaming\python\python37\site-packages\pip\
   from c:\users\jeffr\appdata\roaming\python\python37\site-packages\~ip
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
    status = self.run(options, args)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 404, in run
    use_user_site=options.use_user_site,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 71, in install_given_reqs
    **kwargs
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 815, in install
    warn_script_location=warn_script_location,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 614, in install_wheel
    warn_script_location=warn_script_location,
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 548, in install_unpacked_wheel
    generated_console_scripts = maker.make_multiple(scripts_to_generate)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 415, in make_multiple
    filenames.extend(self.make(specification, options))
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 280, in make
    return super(PipScriptMaker, self).make(specification, options)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 404, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 304, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 239, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\jeffr\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 383, in _get_launcher
    raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
WARNING: You are using pip version 20.0.1; however, version 20.1.1 is available.
You should consider upgrading via the 'C:\ProgramData\Anaconda3\python.exe -m pip install --upgrade pip' command.

any luck with this error....suffering from same

Try upgrading pip.

Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip

Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip

I also got it solved using this one.
Thanks a lot @vikash-jain

I鈥檒l attribute this to a botched pip upgrade. Whatever the cause is seems to have not occured again. It would be nice if someone can submit a pull request to the documentation for future reference.

The easiest way to upgrade pip: easy_install pip
It gives no errors, and it works.

The ensurepip approach is the most appropriate on Python 3. Use get-pip.py if ensurepip is not available (it should in most situations, including Python 2.7). Avoid using easy_install; it is deprecated, and setuptools maintainers want people to not use it (pypa/setuptools#1830).

I'm getting the same error upgrading pip 20.0.2 to pip-20.2.2 (and Python 3.8.2) on Win10.

Tried to do some debugging.

Modifying resources.py and re-running the upgrade:

    def find(self, resource_name):
        path = self._make_path(resource_name)
        path_dir = os.path.dirname(path)
        print('DEBUG: ResourceFinder.find', path_dir, os.path.isdir(path_dir))
        print(os.listdir(path_dir))
        if not self._find(path):

I get this output:

...
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
DEBUG: ResourceFinder.find C:\Users\idbrii\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\distlib True
['.resources.py.swp', '~backport', '~_pycache__']
  Rolling back uninstall of pip
...

So it seems that we're probably removing the contents of distlib during the uninstall but then trying to use them when installing pip.

That's likely fixed on newer version of pip?


I tried these steps to clean install pip but and last step failed:

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip
> C:\Users\idbrii\scoop\apps\python\current\python.exe -m pip install --upgrade pip
C:\Users\idbrii\scoop\apps\python\current\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly executed

Re-running ensurepip showed I had an old 19.2.3 dist-info folder for pip:

> C:\Users\idbrii\scoop\apps\python\current\python.exe -m ensurepip
Looking in links: c:\Users\idbrii\AppData\Local\Temp\tmplf44e1tc
Requirement already satisfied: setuptools in c:\users\idbrii\scoop\apps\python\3.8.2\lib\site-packages (41.2.0)
Requirement already satisfied: pip in c:\users\idbrii\scoop\apps\python\3.8.2\lib\site-packages (19.2.3)

Deleting all the pip folders in C:\Users\idbrii\scoop\apps\python\3.8.2\lib\site-packages allowed me to use ensurepip to get a working pip install again!

Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip

Thanks, that totally worked. I thought it was an Anaconda issue.

I鈥檒l attribute this to a botched pip upgrade. Whatever the cause is seems to have not occured again. It would be nice if someone can submit a pull request to the documentation for future reference.

I already had this issue before and solved it with the ensurepip method. I had to do this again to update to 20.2.4 (as in #9043), so this isn't a one-off, it looks like a persistent issue. In fact, now with the latest version of pip installed, if I do pip install -U pip again the error comes up again. So it seems no amount of uninstall > ensurepip > install will fix this issue.


Update: after drawing some inspiration from @idbrii's comment, even though I didn't have an outdated dist-info folder,

Deleting all the pip folders in C:\Usersidbrii\scoopapps\python\3.8.2\lib\site-packages allowed me to use ensurepip to get a working pip install again!

I deleted all dist-info and egg folders for pip in my site-packages folder, re-ran python -m ensurepip and python -m pip install -U pip, and everything seems to work fine now.

if I do pip install -U pip again

Does this happen with python -m pip install -U pip?

if I do pip install -U pip again

Does this happen with python -m pip install -U pip?

Yes it also happened with the explicit command; but I've found another fix, see the update to my comment above. Sorry for the ping.

Saw somewhere else on the web and tried following steps individually on the command prompt. It helped me move ahead. You can give it a try.

python -m pip uninstall pip
python -m ensurepip
python -m pip install -U pip

Worked like a charm!

@uranusjr wrote:

It would be nice if someone can submit a pull request to the documentation for future reference.

Thus I am reopening this issue as a docs issue. I suggest we add some notes on this within https://pip.pypa.io/en/stable/installing/#upgrading-pip .

Was this page helpful?
0 / 5 - 0 ratings