pip: `ImportError` when running pyproject.toml-based build, since the build-backend can't be found
Description
Currently unable to install packages with the latest release of pip
Expected behavior
No response
pip version
23.0
Python version
3.10
OS
docker ubuntu20.04
How to Reproduce
- use:
RUN add-apt-repository ppa:deadsnakes/ppa \
&& apt update
# NOTE: Must use python3.10 due to finta 2023-01-30
RUN apt install -y python3.10 python3.10-distutils \
&& ln -fs /usr/bin/python3.10 /usr/bin/python3 \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3
Output
#21 0.871 Requirement already satisfied: pip in /usr/local/lib/python3.10/dist-packages (22.3.1)
#21 1.012 Collecting pip
#21 1.018 Using cached pip-23.0-py3-none-any.whl (2.1 MB)
#21 1.093 Installing collected packages: pip
#21 1.093 Attempting uninstall: pip
#21 1.094 Found existing installation: pip 22.3.1
#21 1.260 Uninstalling pip-22.3.1:
#21 1.449 Successfully uninstalled pip-22.3.1
#21 2.530 Successfully installed pip-23.0
#21 2.530 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#21 3.013 Requirement already satisfied: wheel in /usr/local/lib/python3.10/dist-packages (from -r /requirements.txt (line 2)) (0.38.4)
#21 3.115 Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from -r /requirements.txt (line 3)) (67.0.0)
#21 16.99 Collecting rsa<4.8,>=3.1.2
#21 17.01 Downloading rsa-4.7.2-py3-none-any.whl (34 kB)
#21 17.09 Collecting PyYAML<5.5,>=3.10
#21 17.11 Downloading PyYAML-5.4.1.tar.gz (175 kB)
#21 17.13 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 13.2 MB/s eta 0:00:00
#21 17.31 Installing build dependencies: started
#21 20.70 Installing build dependencies: finished with status 'done'
#21 20.70 Getting requirements to build wheel: started
#21 20.74 Getting requirements to build wheel: finished with status 'done'
#21 20.75 ERROR: Exception:
#21 20.75 Traceback (most recent call last):
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
#21 20.75 status = run_func(*args)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
#21 20.75 return func(self, options, args)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/commands/install.py", line 415, in run
#21 20.75 requirement_set = resolver.resolve(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
#21 20.75 result = self._result = resolver.resolve(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
#21 20.75 state = resolution.resolve(requirements, max_rounds=max_rounds)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
#21 20.75 failure_causes = self._attempt_to_pin_criterion(name)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
#21 20.75 criteria = self._get_updated_criteria(candidate)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 204, in _get_updated_criteria
#21 20.75 self._add_to_criteria(criteria, requirement, parent=candidate)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
#21 20.75 if not criterion.candidates:
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
#21 20.75 return bool(self._sequence)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
#21 20.75 return any(self)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
#21 20.75 return (c for c in iterator if id(c) not in self._incompatible_ids)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
#21 20.75 candidate = func()
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
#21 20.75 self._link_candidate_cache[link] = LinkCandidate(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
#21 20.75 super().__init__(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
#21 20.75 self.dist = self._prepare()
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
#21 20.75 dist = self._prepare_distribution()
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
#21 20.75 return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement
#21 20.75 return self._prepare_linked_requirement(req, parallel_builds)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/operations/prepare.py", line 577, in _prepare_linked_requirement
#21 20.75 dist = _get_prepared_distribution(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
#21 20.75 abstract_dist.prepare_distribution_metadata(
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/distributions/sdist.py", line 48, in prepare_distribution_metadata
#21 20.75 self._install_build_reqs(finder)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/distributions/sdist.py", line 118, in _install_build_reqs
#21 20.75 build_reqs = self._get_build_requires_wheel()
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/distributions/sdist.py", line 95, in _get_build_requires_wheel
#21 20.75 return backend.get_requires_for_build_wheel()
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_internal/utils/misc.py", line 701, in get_requires_for_build_wheel
#21 20.75 return super().get_requires_for_build_wheel(config_settings=cs)
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
#21 20.75 return self._call_hook('get_requires_for_build_wheel', {
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_impl.py", line 321, in _call_hook
#21 20.75 raise BackendUnavailable(data.get('traceback', ''))
#21 20.75 pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
#21 20.75 File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
#21 20.75 obj = import_module(mod_path)
#21 20.75 File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
#21 20.75 return _bootstrap._gcd_import(name[level:], package, level)
#21 20.75 File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
#21 20.75 File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
#21 20.75 File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
#21 20.75 File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
#21 20.75 File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
#21 20.75 File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
#21 20.75 File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
#21 20.75 ModuleNotFoundError: No module named 'setuptools'
Code of Conduct
- I agree to follow the PSF Code of Conduct.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 16 (8 by maintainers)
Commits related to this issue
- temporarily pin pip to <23 per https://github.com/pypa/pip/issues/11770 Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu> — committed to njzjz/deepmd-kit by njzjz a year ago
- temporarily pin pip to <23 (#2287) per https://github.com/pypa/pip/issues/11770 — committed to deepmodeling/deepmd-kit by amcadmus a year ago
- 💚(e2e) fix e2e pip installation Last pip version introduces a bug with ubuntu 20 See https://github.com/pypa/pip/issues/11770 So we decided to pin pip to version < 23.0 — committed to openfun/marsha by kernicPanel a year ago
- 💚(e2e) fix e2e pip installation Last pip version introduces a bug with ubuntu 20 See https://github.com/pypa/pip/issues/11770 So we decided to pin pip to version < 23.0 Thanks @jmaupetit @lunika — committed to openfun/marsha by kernicPanel a year ago
- 💚(e2e) fix e2e pip installation Last pip version introduces a bug with ubuntu 20 See https://github.com/pypa/pip/issues/11770 So we decided to pin pip to version < 23.0 Thanks @jmaupetit @lunika — committed to openfun/marsha by kernicPanel a year ago
Upgraded Dockerfile to use Ubuntu 22.04 did correct the error.
Still seems to be an error for 20.04.
I think this is the issue fixed by #11740.
After you downgrade pip, you can also check that the proposed resolution for this bug works for you too installing pip from the git repository:
python -m pip install "pip @ git+https://github.com/pypa/pip.git"
I am running on 22.04 and this error still happens. Shall we reopen?