[BUG] On Debian, install fails with "no such option 'install_layout'".
See original GitHub issuesetuptools version
60.0.4
Python version
Python 3.9.9
OS
Ubuntu 21.10
Additional environment information
Running DEB packaging with dh-python.
Description
In Debian setuptools packaging an additional patch applied: https://sources.debian.org/src/python-setuptools/44.1.1-1/debian/patches/install-layout.diff
During 59.8.0, running debuild -uc -us
for building setuptools WITHOUT about patch keep functioning.
During 60.0.0+, no matter with / without about patch, running debuild -uc -us
keep failing.
If modify the build script as below, build now OK:
override_dh_auto_install:
- dh_auto_install
+ export SETUPTOOLS_USE_DISTUTILS=stdlib && dh_auto_install
Expected behavior
For v59.8.0 WITHOUT any additional patch it is OK:
sudo podman run -ti --rm ubuntu:21.10 bash
apt update
apt -y full-upgrade
apt -y install git curl wget python3 python3-all python3-dev dh-python fdupes build-essential devscripts debhelper
git clone -b alvistack/v59.8.0 https://github.com/alvistack/pypa-setuptools.git
cd pypa-setuptools
git clean -xdf
tar zcvf ../python-setuptools_59.8.0.orig.tar.gz --exclude=.git .
debuild -uc -us
For v60.0.4 WITH SETUPTOOLS_USE_DISTUTILS=stdlib
it is OK:
sudo podman run -ti --rm ubuntu:21.10 bash
apt update
apt -y full-upgrade
apt -y install git curl wget python3 python3-all python3-dev dh-python fdupes build-essential devscripts debhelper
git clone -b alvistack/v60.0.4 https://github.com/alvistack/pypa-setuptools.git
cd pypa-setuptools
git clean -xdf
tar zcvf ../python-setuptools_60.0.4.orig.tar.gz --exclude=.git .
debuild -uc -us
How to Reproduce
For v60.0.4 WITHOUT SETUPTOOLS_USE_DISTUTILS=stdlib
it is FAILED:
sudo podman run -ti --rm ubuntu:21.10 bash
apt update
apt -y full-upgrade
apt -y install git curl wget python3 python3-all python3-dev dh-python fdupes build-essential devscripts debhelper
git clone -b alvistack/v60.0.4 https://github.com/alvistack/pypa-setuptools.git
cd pypa-setuptools
find *.spec debian/rules -type f | xargs sed -i 's/export SETUPTOOLS_USE_DISTUTILS=stdlib && //g'
git clean -xdf
tar zcvf ../python-setuptools_60.0.4.orig.tar.gz --exclude=.git .
debuild -uc -us
Output
debian/rules override_dh_auto_install
make[1]: Entering directory '/pypa-setuptools'
dh_auto_install
I: pybuild base:232: /usr/bin/python3 setup.py install --root /pypa-setuptools/debian/tmp
/pypa-setuptools/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'build-lib' will not be supported in future versions. Please use the underscore name 'build_lib' instead
warnings.warn(
/pypa-setuptools/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'install-layout' will not be supported in future versions. Please use the underscore name 'install_layout' instead
warnings.warn(
/pypa-setuptools/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'install-scripts' will not be supported in future versions. Please use the underscore name 'install_scripts' instead
warnings.warn(
/pypa-setuptools/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'install-lib' will not be supported in future versions. Please use the underscore name 'install_lib' instead
warnings.warn(
running install
/pypa-setuptools/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
error: error in /pypa-setuptools/.pybuild/cpython3_3.9/.pydistutils.cfg: command 'install_with_pth' has no such option 'install_layout'
E: pybuild pybuild:353: install: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py install --root /pypa-setuptools/debian/tmp
dh_auto_install: error: pybuild --install -i python{version} -p 3.9 --dest-dir /pypa-setuptools/debian/tmp returned exit code 13
make[1]: *** [debian/rules:6: override_dh_auto_install] Error 25
make[1]: Leaving directory '/pypa-setuptools'
make: *** [debian/rules:16: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed
Code of Conduct
- I agree to follow the PSF Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Bug#1003252: AttributeError: install_layout - Google Groups
Since setuptools 60+ is out with SETUPTOOLS_USE_DISTUTILS defaulting to "local", pip install --editable in --system-site-packages venvs fails:
Read more >python - AttributeError: install_layout when attempting to install ...
I had a very similar issue with an other packages after upgrading to Ubuntu 22.04, and it apparently comes from setuptools.
Read more >5.4. Troubleshooting the Installation Process - Debian
There are two very simple things that you should try first. If the disc does not boot, check that it was inserted correctly...
Read more >python2.7: modules built with distutils + --prefix=/usr not ...
This results in the python files being installed in ... for 2.6.1-3 says "The options --install-layout=deb and --prefix are exclusive.
Read more >gdebi-gtk cannot install packages - Debian Bug report logs
The symptoms are that gdebi says on screen `failed to install [package].deb'. There is no further explanation and the terminal window ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In pypa/distutils@69f85733543b9f6257e89c4f79f9507f20d06b49 (
debian-patch
branch), I’ve added one additional step that extends the install schemes in sysconfig to include the deb_system. And now the repro above builds without error:Is that sufficient to close this issue, at least until Debian maintainers step up with an alternative proposal?
I considered this approach, but there are two problems with the approach:
get_preferred_scheme
). It’s imperative that Debian utilize the general-purpose approach and if it’s inadequate, describe what the gaps are and propose a solution that fills those gaps.Remember that SETUPTOOLS_USE_DISTUTILS=stdlib is a temporary escape hatch. It’s there to enable end users and installers to opt out of the inevitable transition to a world without distutils in the stdlib (slated for Python 3.12). Making this change permanent in an environment does simplify orchestration of that environment, but it also has the following downsides:
=local
.Could you set that environment variable globally in the Debian environment? At least for now until Debian can adopt an approach that no longer relies on monkeypatching?
As distutils is going away, this approach is untenable. Setuptools is committed to adopting distutils, so if Debian wishes to own a patching approach, they would need to patch setuptools. They’re welcome to do so if that’s what they wish, but Setuptools is expecting to perform a great deal of refactoring to properly adopt distutils and remove the cruft around it, so maintaining a monkeypatch for versions of Setuptools as its evolving is going to be burdensome. That’s why this project is going out of its way to provide reliable if temporary interfaces to allow for the customizations currently provided by patches.
I’m guessing by “Monkeypatch style”, you mean the approach currently proposed by this project?
Yes, this approach is somewhat complicated, but it’s less brittle than patching as done in option 1 because it specifically patches the runtime objects and not the code, so only relies on the hook points provided by distutils. Yes, it requires coordination, but since it’s meant to be temporary, I’d expect that Debian would find a way to move away from relying on these interfaces.
The primary advantage of the monkeypatch approach is that it keeps the patched behavior largely disentangled from the default implementation. That is, any Python programmer can see the entirety of the patch and disable it by deleting
_distutils_system_mod
or commenting out theapply_customizations()
call.I do see your point about maybe preferring option 1. I might prefer that too. Unfortunately, I don’t think Debian is interested in owning it, so I’ve supplied the system mod approach as a means of unblocking users while Debian figures out how they want to proceed. If they want to keep these behaviors long-term, they should propose the behaviors as a proper feature of the project (with designs, implementations, tests, etc).
I do regret that you’ve been caught up in this. I would have preferred that Debian maintainers would have picked this up sooner and implemented the recommended patch, tested it, and provided forward guidance to downstream packagers like yourself. I appreciate your feedback and the effort you’ve taken to understand the issue.
I welcome you or others to engage with the Debian project to devise a better solution. Right now,
_distutils_system_mod
is my best proposal, but it’s optional and I won’t be offended if Debian wishes to take another approach, and I offer my time and services as maintainer of Setuptools/distutils to give feedback or otherwise help guide their decisions.It does feel like you’re 🤏 this close to having a working solution. Let me take a stab at extending the
_distutils_system_mod
to provide thedeb_system
andunix_system
install schemes needed to honor the--install-layout
. Thanks for the repro, which should make it easy for me to test.