Unexpected behavior when distutils is invoked before Setuptools
See original GitHub issueTL;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)
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
How to fix 'UserWarning: Distutils was imported before ...
This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed ...
Read more >distutils-r1 — standard Python build systems
The legacy mode invokes the setup.py script directly. The build command is invoked to populate the build directory in the compile phase, then...
Read more >twine 4.0.2 documentation
The biggest reason to use Twine is that it securely authenticates you to PyPI over HTTPS using a verified connection, regardless of the...
Read more >This Way Up: A Bottom-Up Look At Python Packaging
A long standing criticism of setuptools (and distutils before it) was its use of a Python script ( setup.py ), instead of a...
Read more >Setuptools can't find my GCC compiler - Numba Discussion
I am attempting to include my AOT-compiled extensions in my setup.py. from setuptools import setup import sys import os script_path ...
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
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).