setuptools: Unexpected behavior when distutils is invoked before Setuptools
TL;DR We are forced to use distutils because setuptools has broken symlink processing and this causes distutils.errors.DistutilsClassError: command class <class '__main__.SDistCommand'> must subclass Command
.
It works with setuptools<48
and the changelog doesn’t document any breaking behaviors for this version.
Repro:
$ git clone https://github.com/ansible/ansible.git
$ cd ansible
$ pip install -U 'setuptools>=48'
$ python setup.py sdist
(tried under Python 3.8)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- Disable adopted distutils while troubleshooting #2228 and #2230. — committed to pypa/setuptools by jaraco 4 years ago
- Update changelog. Ref #2228 and #2230. — committed to pypa/setuptools by jaraco 4 years ago
- Amend changelog for 48.0 to include more detail about usage expectations. Ref #2230. — committed to pypa/setuptools by jaraco 4 years ago
- Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short-term hotfix for the problem and we'll need to consider dropping ... — committed to webknjaz/ansible by webknjaz 4 years ago
- Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short-term hotfix for the problem and we'll need to consider dropping ... — committed to webknjaz/ansible by webknjaz 4 years ago
- Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short-term hotfix for the problem and we'll need to consider dropping ... — committed to webknjaz/ansible by webknjaz 4 years ago
- Warn the user when distutils is present to discourage this usage and direct users to the recommended usage. Closes #2230. — committed to pypa/setuptools by jaraco 4 years ago
- Warn the user when distutils is present to discourage this usage and direct users to the recommended usage. Closes #2230. — committed to pypa/setuptools by jaraco 4 years ago
- Fix building Ansible dist w/ setuptools>=48,<49.1 (#70525) * Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short... — committed to ansible/ansible by webknjaz 4 years ago
- Fix building Ansible dist w/ setuptools>=48,<49.1 (#70525) * Fix building Ansible dist w/ setuptools>=48,<49.1 This change addresses the deprecation of the use of stdlib `distutils`. It's a short-te... — committed to sivel/ansible by webknjaz 4 years ago
- [stable-2.10] Guard against allowing ansible to ansible-base upgrades (#70529) (#70760) * Fix building Ansible dist w/ setuptools>=48,<49.1 (#70525) * Fix building Ansible dist w/ setuptools>=48,<... — committed to ansible/ansible by sivel 4 years ago
We also run into this warning in pandas, where we use
distutils.version
for version checking in the actual library (so not just in the packaging code).Great. Thanks for enacting that.
I’m wondering if there’s something that Setuptools should do here to help other projects with similar usages from encountering the same issue as we bring the adopted distutils back. For example, the project could:
sys.modules
(except on PyPy, where that’s the status quo on startup).I think I’ll enact (1) now and give it some time to percolate over the weekend and maybe longer.
Do please consider filing something with Ansible to investigate a long-term solution for what Ansible will do when distutils is sunset and all that’s left is Setuptools (as that’s the plan).
In the referenced commit, I’ve updated the changelog to clarify the weaknesses identified from this bug report and guide users to the best practices. Can you confirm that this guidance and applying the recommended changes in Ansible addresses the concern?
Thanks for the report.
Setuptools 49.1 is out, should address the issue for early adopters while I triage and correct the issue.