• Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

PIP was upgraded in WindWS 10. During the upgrade, the installation package was downloaded and the original PIP was successfully uninstalled. However, when installing the new PIP package, the installation failure caused PIP to be uninstalled due to various reasons.

Common reasons for

  • The Anaconda folder in Windows does not provide all control rights for users users
  • When PIP is updated the command is (this is the wrong command) :
pip install -U pip
Copy the code

At this point PIP downloads the latest PIP installation package from the server, uninstalls the original PIP, but does not have permission to install the new PIP

No PIP is available after the PIP is updated using this command

Correct command shell

  • Add –user to the options
pip install --upgrade pip --user
Copy the code

Repair order

  • If the fault persists, run the following command to recover the fault
python -m ensurepip
python -m pip install --upgrade pip
Copy the code

The actual effect

$ pip list
Traceback (most recent call last):
  File "e:\program_files\annoconda\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\program_files\annoconda\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Program_Files\Annoconda\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

$ python -m ensurepipLooking in links: C:\Users\Admin\AppData\Local\Temp\tmp1ggp6o2t Requirement already satisfied: Setuptools in E: program_files annoconda lib site-packages (45.1.0) Collecting PIP jupyterlab 2.1.0 has requirement Jupyterlab_server > = 1.1.0, But you 'l l have jupyterlab -server 1.0.0 which is incompatible. Jupyterlab -server 1.0.0 from the requirement Imgviz 1.1.0 has requirement Pillow>=5.3.0, jsonSchema >=3.0.1, but you'll have JsonSchema 2.6.0 which is incompatible. Imgviz 1.1.0 has requirement Pillow>=5.3.0, But you'll have pillow 5.2.0 which is incompatible. Installing collected packages: PIP Successfully installed PIP-10.0.1
$ python -m pip install --upgrade pipLooking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting pip Using cached https://mirrors.aliyun.com/pypi/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-p Y2.py3-none-any. WHL jupyterlab 2.1.0 has requirement jupyterlab_server>=1.1.0, But you 'l l have jupyterlab -server 1.0.0 which is incompatible. Jupyterlab -server 1.0.0 from the requirement Imgviz 1.1.0 has requirement Pillow>=5.3.0, jsonSchema >=3.0.1, but you'll have JsonSchema 2.6.0 which is incompatible. Imgviz 1.1.0 has requirement Pillow>=5.3.0, But you'll have pillow 5.2.0 which is incompatible. Installing collected packages: PIP Found existing installation: PIP 10.0.1 Uninstalling PIP - 10.0.1: Successfully uninstalled pip-10.0.1 Successfully installed pip-20.1.1 You are using PIP version 20.1.1, However version 20.2B1 is available. You should consider upgrading via the 'python-m PIP install --upgrade PIP' command.Copy the code