ImportError: cannot import name 'RequirementInformation' from 'pip._vendor.resolvelib.structs'
ImportError: cannot import name 'RequirementInformation' from 'pip._vendor.resolvelib.structs'
ERROR: Exception:
Traceback (most recent call last):
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 404, in run
resolver = self.make_resolver(
^^^^^^^^^^^^^^^^^^^
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 353, in make_resolver
import pip._internal.resolution.resolvelib.resolver
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 7, in <module>
from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_vendor/resolvelib/__init__.py", line 19, in <module>
from .resolvers import (
File "/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py", line 1, in <module>
from ..structs import RequirementInformation
ImportError: cannot import name 'RequirementInformation' from 'pip._vendor.resolvelib.structs' (/home/admin/miniconda3/envs/env311copy/lib/python3.11/site-packages/pip/_vendor/resolvelib/structs.py)
解决方法如下: 可行。
https://www.cnblogs.com/emanlee/p/18894384
================================
The issue is caused by a conflict between the cached Python environment and the attempt to downgrade pip to version 24.2, while the setup-python action installs the latest version by default (currently 25.1). This discrepancy can cause compatibility issues if the cached environment includes dependencies or configurations tied to a different version of pip.
Here are a few recommended solutions:
-
Use the Latest pip Version:
If your project doesn’t require a specific version ofpip, consider using the latest version (currently 25.1) to avoid potential conflicts with cached dependencies. This approach eliminates the need for managing multiple versions and ensures compatibility with the latest packages. -
Explicit pip Version Management:
To avoid version conflicts, install the requiredpipversion (24.2) right aftersetup-pythonaction. This ensures the environment aligns with workflow expectations:
steps:
...
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install specific pip version
run: python -m pip install --upgrade pip==24.2
- name: Restore cache
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.OS }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/REQUIREMENTS-CI.txt') }}
Let us know if this resolves the issue or if you need any further assistance!

浙公网安备 33010602011771号