5

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

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\__main__.py", line 23, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 8, in <module>
    from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:\Users\SE> 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?

halfer
  • 19,824
  • 17
  • 99
  • 186
amalp12
  • 185
  • 2
  • 10

3 Answers3

19

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:\Users\xyz\Downloads> 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.

Community
  • 1
  • 1
Nasreen Ustad
  • 1,564
  • 1
  • 19
  • 24
0

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

Hope this helps!

10 Rep
  • 2,217
  • 7
  • 19
  • 33
0

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!

Swetank Poddar
  • 1,257
  • 9
  • 23