0

I have python 3.8 & 3.9 and 3.10 and 3.11 installed, however pip install does not work for 3.10 and 3.11 and only works for the rest simply please observe:

pip3 install jedi

returns:

    Requirement already satisfied: jedi in /home/user/.local/lib/python3.8/site-packages (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/user/.local/lib/python3.8/site-packages (from jedi) (0.7.1)

so does:

pip install jedi

returns

Requirement already satisfied: jedi in /home/user/.local/lib/python3.8/site-packages (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/user/.local/lib/python3.8/site-packages (from jedi) (0.7.1)

as well as :

python3.8 -m pip install jedi

results in:

Requirement already satisfied: jedi in /home/c/.local/lib/python3.8/site-packages (0.17.2)

Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/c/.local/lib/python3.8/site-packages (from jedi) (0.7.1)

However

python3.10 -m pip install jedi

results in :

  Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 19, in <module>
    sys.exit(_main())
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 15, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 21, in <module>
    from pip._internal.index.collector import parse_links
  File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 12, in <module>
    from pip._vendor import html5lib, requests
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)

Python versions are managed by alternatives

update-alternatives --query python

which returns:

Name: python
Link: /usr/bin/python
Status: auto
Best: /usr/bin/python3.8
Value: /usr/bin/python3.8

Alternative: /usr/bin/python3.8
Priority: 80

and

update-alternatives --query python3

returns:

Name: python3
Link: /usr/bin/python3
Status: auto
Best: /usr/bin/python3.8
Value: /usr/bin/python3.8

Alternative: /usr/bin/python3.10
Priority: 40

Alternative: /usr/bin/python3.8
Priority: 90

I tried re-installing practically everything including python versions and the modules to no avail.

I am not too sure what is the root of the problem or actually what is the process that leads here, it only does

Max
  • 4,152
  • 4
  • 36
  • 52
  • it looks that html5lib is not supported with python version > 3.9 https://github.com/html5lib/html5lib-python/issues/537 – Panda50 Nov 27 '21 at 06:55
  • Is there a replacement library?!!! – Max Nov 27 '21 at 07:28
  • But because your error is related to pip, I'm not sure it doesn't work because of html5lib. It more looks like something between that package and the pip version you're using with python 3.10 Here is maybe a solution for you : https://stackoverflow.com/questions/69503329/pip-is-not-working-for-python-3-10-on-ubuntu – Panda50 Nov 27 '21 at 07:57
  • I've just tried on windows, using pip==21.3.1 ; I had no issues to pip install html5lib – Panda50 Nov 27 '21 at 08:10
  • @Panda50 with Python3.10? – Max Nov 27 '21 at 08:19
  • Yes with python 3.10 on windows 10 21H1 (sorry for the delay). – Panda50 Nov 27 '21 at 09:30
  • @Panda50 so how do I go about finding out what is going on? – Max Nov 27 '21 at 10:25
  • Try ```python3.10 -m pip install --upgrade pip``` and then ```python3.10 -m pip install jedi``` ? – Panda50 Nov 30 '21 at 17:55

2 Answers2

-2

It's always best to run the pip as a main module with the version of Python you want to install for.

python3.9 -m pip install ...
python3.10 -m pip install ...
python3.11 -m pip install ...

If you want to force an upgrade, use the --upgrade option.

Keith
  • 42,110
  • 11
  • 57
  • 76
-2

First try to install pygames

PS > py -m pip install pygames

ERROR: Could not find a version that satisfies the requirement
pygames (from versions: none)

ERROR: No matching distribution found for pygames

There is a version conflict. I have many Python versions (2.4 - 3.11) on Windows 11.

py laucher defaults to highest Python version installed.

=> specify py launcher option -xx.yy-ZZ like:

(More info: py --help)

PS > py  -3.7-32  -m pip install -U pygame

Collecting pygame

  Downloading pygame-2.1.2-cp37-cp37m-win32.whl (8.1 MB)

 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

 8.1/8.1 MB 1.2 MB/s

Installing collected packages: pygame

Successfully installed pygame-2.1.2

PS > py -3.7-32

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

'>>> from pygame import *'

'>>>'

Happy end!

Ishita Sinha
  • 2,168
  • 4
  • 25
  • 38