pip fails to install pathlib in Ubuntu 22.04 with "setuptools is not available in the build environment"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-pip (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The latest 22.04 updates have broken pathlib. pip complains that setuptools is not available in the build environment even though the package python3-setuptools v59.6.0-1.2 is installed. This breaks any package relying on pathlib.
The output from the install command is:
rocko@ubuntu:~$ pip install pathlib
Defaulting to user installation because normal site-packages is not writeable
Collecting pathlib
Downloading pathlib-
━━
Preparing metadata (setup.py) ... error
error: subprocess-
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: python3-pip 22.0.2+dfsg-1
ProcVersionSign
Uname: Linux 5.15.0-18-generic x86_64
ApportVersion: 2.20.11-0ubuntu78
Architecture: amd64
CasperMD5CheckR
Date: Thu Mar 3 15:13:02 2022
InstallationDate: Installed on 2021-09-28 (156 days ago)
InstallationMedia: Ubuntu 21.10 "Impish Indri" - Beta amd64 (20210924)
PackageArchitec
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: python-pip
UpgradeStatus: Upgraded to jammy on 2022-02-18 (12 days ago)
Importing setuptools in a python interpreter works fine:
rocko@ubuntu:~$ python3
Python 3.10.2 (main, Feb 26 2022, 08:21:15) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
... import setuptools
... print('ok')
... except ImportError as error:
... print('failed')
...
ok
>>>
But this same code fails when pip tries to install pathlib:
rocko@ubuntu:~$ pip -v install pathlib python3/ dist-packages/ pip (python 3.10) 1.0.1.tar. gz (49 kB) exited- with-error
Using pip 22.0.2 from /usr/lib/
Defaulting to user installation because normal site-packages is not writeable
Collecting pathlib
Using cached pathlib-
Running command python setup.py egg_info
ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
error: subprocess-
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. compile( '"'"''" '"''"'" ' -caller> -- a caller that pip uses to run setup.py
full command: /usr/bin/python3 -c '
exec(
# This is <pip-setuptools
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
file= sys.stderr,
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
)
sys.exit(1)
__file__ = %r