简体   繁体   中英

Pip fails to install long requirements.txt on 22.04 Kubuntu/Ubuntu

(This isn't much of a question, it's more out here because when I ran into the problem I didn't find the answer and wanted to ensure others that run into this find it.)

I am on a newly installed 22.04 Kubuntu system. Every time I upgrade, I end up needing to rebuild my virtual environments. I was using a requirements.txt I had dumped from my latest virtualenv before upgrading to 22.04.

When I attempted to install a requirements.txt that was long, I ran into the following error:

Traceback (most recent call last):
  File "/home/bitreaper/venv/venv3.10/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/bitreaper/venv/venv3.10/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/home/bitreaper/venv/venv3.10/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 389, in run
    to_install = resolver.get_installation_order(requirement_set)
  File "/home/bitreaper/venv/venv3.10/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 188, in get_installation_order
    weights = get_topological_weights(
  File "/home/bitreaper/venv/venv3.10/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 276, in get_topological_weights
    assert len(weights) == expected_node_count
AssertionError

I could install the package immediately above this error, if I just did the pip install of the package itself. But every time I did that, and ran the pip install again with the requirements.txt, it would fail again with the same error.

At this point, I decided to run a docker image of Python 3.9.12, and use the same requirements.txt. This installed without issue. I then decided to use a docker image of 3.10.4, and it installed without issue in that one as well. I compared the versions of pip, and the docker image had 22.0.4, where stock install of Kubuntu has 22.0.2. When I did

pip install --upgrade pip

the invocation with the long list worked.

The problem seems to lie in the stock pip installed. If you do:

pip install --upgrade pip

and get a version that is newer than 22.0.2, it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM