pythonpipvirtualenvmodulenotfounderrordowngrade

Downgrading python's pip


So, I want to downgrade my pip to version pip==21 in my python virtual enviroment. Problem is, that in most cases it gives me the same error when trying to run that downgraded pip:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Jaros\pva_projekt\.venv\Scripts\pip.exe\__main__.py", line 4, in <module>
    from pip._internal.cli.main import main
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\main.py", line 8, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\cmdoptions.py", line 22, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 9, in <module>
    from pip._internal.utils.logging import get_indentation
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\utils\logging.py", line 14, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_internal\utils\misc.py", line 20, in <module>
    from pip._vendor import pkg_resources
  File "C:\Users\Jaros\pva_projekt\.venv\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 58, in <module>
    from pip._vendor.six.moves import urllib, map, filter
ModuleNotFoundError: No module named 'pip._vendor.six.moves'

The most obvious thing I tried was python -m pip install pip==21. It "Successfully installed pip-21.0", but when I tried to use it, or typed pip --version, it outputted same error. I also tried python get-pip.py pip==21.0, which didn't worked. Then I tried:

python -m ensurepip --upgrade
python -m pip install pip==21.0

And that also made nothing. I also tried this: python -m pip install --force-reinstall pip==21.0 without any success. I also tried it outside virtualenv, and it seems to give me same error.


Solution

  • So I resolved my problem by downgrading to python 3.9.7, which uses pip version that I needed, but I still don't know what is causing that error, when trying to downgrade pip to pip==21 on python 3.13.0, but as @flexter suggested, it's likely that that pip 21 isn't compatible with this version.