My pip is broken on Windows, how can I fix it?

Question:

Whenever I try to use pip, using any command I get this:

Traceback (most recent call last):
  File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0librunpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0librunpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip__main__.py", line 23, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip_internalclimain.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip_internalcliautocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip_internalclimain_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip_internalclicmdoptions.py", line 24, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "C:UsersSEAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0LocalCachelocal-packagesPython38site-packagespip_internalcliprogress_bars.py", line 8, in <module>
    from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:UsersSE> No module named 'pip._vendor.progress'No module named 'pip._vendor.progress'

I am on Windows 10, 64 bit, Python version 3.7.7.

I cannot use pip, how can I fix it?

Asked By: amalp12

||

Answers:

Try doing python -m pip install pytest. This should install it, and it will make it usable by your IDE.

Hope this helps!

Answered By: 10 Rep

You could follow the equivalent steps mentioned here and here (Both are closed issues on pip’s github page) on your windows machine.

On windows you can do this:

python -m pip uninstall pip setuptools # Sometimes setuptools might be the problem

This will uninstall pip and setuptools.

After which you can reinstall them using

python -m ensurepip

This will install pip and setuptools.

I have tried this on my windows 10 machine running Python 3.7.4!

Answered By: Swetank Poddar

If pip is broken after an attempted upgrade to a newer version, try the following:

  1. Download get-pip.py and "Save As" the file using right-click.

  2. Open a command prompt as an administrator

  3. cd to the path where you saved the file, in my case
    cd C:UsersxyzDownloads> then type python get-pip.py. It will install all required packages, such as wheel and pip.

  4. To check if it installed correctly, type pip --version in the command line.

Hope my answer helps someone. Happy coding.

Answered By: Nasreen Ustad
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.