3

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
  • 18,701
  • 13
  • 79
  • 158
amalp12
  • 43
  • 6

3 Answers3

10

when pip has broken after an upgrade then use the following simple steps:

  1. go to the link get-pip.py and "Save As" the file using right-click.
  2. open a command prompt using and go to the path where you saved the file. in my case
    "cd C:\Users\xyz\Downloads>" then type "py get-pip.py". it will install all the required packages like wheel and pip.
  3. "C:\Users\xyz\Downloads>py get-pip.py" after successfully installed you can check the pip version using "pip --version".
  4. Hope my answer would help someone. Happy Coding :) :) :)
Nasreen Ustad
  • 964
  • 12
  • 21
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,325
  • 7
  • 15
  • 28
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,097
  • 7
  • 18