2024-03-28 19:39:51 |
Dave Jones |
description |
The version in Ubuntu 22.04 of python3-build cannot create a virtual environment, which makes the package rather unusable.
For instance, in a directory with a file pyproject.toml like this:
# cat pyproject.toml
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools >= 40.6.0", "wheel", "numpy"]
build-backend = "setuptools.build_meta"
If running "python3 -m build ." one gets the following:
# python3 -m build .
* Creating venv isolated environment...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/build/__main__.py", line 372, in main
built = build_call(
File "/usr/lib/python3/dist-packages/build/__main__.py", line 229, in build_package_via_sdist
sdist = _build(isolation, builder, outdir, 'sdist', config_settings, skip_dependency_check)
File "/usr/lib/python3/dist-packages/build/__main__.py", line 140, in _build
return _build_in_isolated_env(builder, outdir, distribution, config_settings)
File "/usr/lib/python3/dist-packages/build/__main__.py", line 104, in _build_in_isolated_env
with _IsolatedEnvBuilder() as env:
File "/usr/lib/python3/dist-packages/build/env.py", line 104, in __enter__
executable, scripts_dir = _create_isolated_env_venv(self._path)
File "/usr/lib/python3/dist-packages/build/env.py", line 258, in _create_isolated_env_venv
executable, script_dir, purelib = _find_executable_and_scripts(path)
File "/usr/lib/python3/dist-packages/build/env.py", line 303, in _find_executable_and_scripts
raise RuntimeError(f'Virtual environment creation failed, executable {executable} missing')
RuntimeError: Virtual environment creation failed, executable /tmp/build-env-iz5c20gn/local/bin/python missing
ERROR Virtual environment creation failed, executable /tmp/build-env-iz5c20gn/local/bin/python missing
This seems to be the same error as reported elsewhere (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009916, https://github.com/pypa/build/pull/463).
The patched version python3-build 0.7.0-3 in Ubuntu 22.10 already fixes that.
It would be great if the patch is also applied to Ubuntu 22.04, since otherwise the main method to build python packages is kind of broken in an Ubuntu LTS version.
The patch seems to be this one (but I have not tried it myself):
https://sources.debian.org/src/python-build/0.7.0-3/debian/patches/debian-sysconfig-layouts.patch/
Thank you!
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: python3-build 0.7.0-2
ProcVersionSignature: Ubuntu 4.15.0-189.200-generic 4.15.18
Uname: Linux 4.15.0-189-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Fri Oct 7 01:08:34 2022
PackageArchitecture: all
SourcePackage: python-build
UpgradeStatus: No upgrade log present (probably fresh install) |
[ Impact ]
The version in Ubuntu 22.04 of python3-build cannot create a virtual
environment, which severely hampers the use of the package. While this
can be worked around to some extent by installing python3-virtualenv,
this still fails with the use of interpreters from deadsnakes.
Given the intent of the package is to cleanly build sdist and binary
wheels, e.g. for PyPI, the ability to work with deadsnakes
interpreters is extremely useful.
[ Test Plan ]
* Verify the current situation in a jammy instance / container:
sudo apt install python3-build python3-venv
mkdir myproj
cd myproj
cat << EOF > pyproject.toml
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools >= 40.6.0", "wheel", "numpy"]
build-backend = "setuptools.build_meta"
EOF
python3 -m build .
* Verify this fails with the error Virtual environment creation
failed
* Enable proposed (https://wiki.ubuntu.com/Testing/EnableProposed)
* Upgrade python3-build and check the error no longer occurs:
sudo apt install -t jammy-proposed python3-build
python3 -m build .
* Verify this produces a valid sdist and wheel (for UNKNOWN 0.0.0)
[ Regression Potential ]
Given the package does not currently work without workarounds, the
potential for regression is already pretty low. The backported version
is the same upstream version, and simply adds a single Debian patch to
work around the issue. The patched version was already present in
lunar, and worked without incident there.
There is one concerning reverse dependency, which is dh-python (which
relies on this package for handling pyproject builds), however in
mitigation I again note that the updated version worked without issue
in lunar.
[ Original Description ]
The version in Ubuntu 22.04 of python3-build cannot create a virtual environment, which makes the package rather unusable.
For instance, in a directory with a file pyproject.toml like this:
# cat pyproject.toml
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools >= 40.6.0", "wheel", "numpy"]
build-backend = "setuptools.build_meta"
If running "python3 -m build ." one gets the following:
# python3 -m build .
* Creating venv isolated environment...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/build/__main__.py", line 372, in main
built = build_call(
File "/usr/lib/python3/dist-packages/build/__main__.py", line 229, in build_package_via_sdist
sdist = _build(isolation, builder, outdir, 'sdist', config_settings, skip_dependency_check)
File "/usr/lib/python3/dist-packages/build/__main__.py", line 140, in _build
return _build_in_isolated_env(builder, outdir, distribution, config_settings)
File "/usr/lib/python3/dist-packages/build/__main__.py", line 104, in _build_in_isolated_env
with _IsolatedEnvBuilder() as env:
File "/usr/lib/python3/dist-packages/build/env.py", line 104, in __enter__
executable, scripts_dir = _create_isolated_env_venv(self._path)
File "/usr/lib/python3/dist-packages/build/env.py", line 258, in _create_isolated_env_venv
executable, script_dir, purelib = _find_executable_and_scripts(path)
File "/usr/lib/python3/dist-packages/build/env.py", line 303, in _find_executable_and_scripts
raise RuntimeError(f'Virtual environment creation failed, executable {executable} missing')
RuntimeError: Virtual environment creation failed, executable /tmp/build-env-iz5c20gn/local/bin/python missing
ERROR Virtual environment creation failed, executable /tmp/build-env-iz5c20gn/local/bin/python missing
This seems to be the same error as reported elsewhere (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009916, https://github.com/pypa/build/pull/463).
The patched version python3-build 0.7.0-3 in Ubuntu 22.10 already fixes that.
It would be great if the patch is also applied to Ubuntu 22.04, since otherwise the main method to build python packages is kind of broken in an Ubuntu LTS version.
The patch seems to be this one (but I have not tried it myself):
https://sources.debian.org/src/python-build/0.7.0-3/debian/patches/debian-sysconfig-layouts.patch/
Thank you!
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: python3-build 0.7.0-2
ProcVersionSignature: Ubuntu 4.15.0-189.200-generic 4.15.18
Uname: Linux 4.15.0-189-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Fri Oct 7 01:08:34 2022
PackageArchitecture: all
SourcePackage: python-build
UpgradeStatus: No upgrade log present (probably fresh install) |
|