-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] distutils cannot be imported on Python 3.12 (without distutils) if pip was imported #3661
Comments
It doesn't seem to be related to pip, setuptools just do not support python 3.12. When running setuptools'
|
I get this even without explicitly importing pip (i.e. just importing setuptools). Any further information on this? |
Hi, |
Hi @sathyz, thank you very much for working on this. If you need to change anything of distutils please submit a PR to https://github.com/pypa/distutils. But on a first glance I think we could tackle this issue by modifying https://github.com/pypa/setuptools/blob/main/_distutils_hack/__init__.py... What if the finder is always enabled for Python >= 3.12? |
Hi @abravalheri
I tried installing a package that was breaking earlier and is now working fine. One of the problem that I see is, pypa/distutils is not in pypi.org that I couldn't do |
After installing Python 3.12 today on macOS, I get this: $ asdf install python 3.12.0
python-build 3.12.0 /Users/[REDACTED]/.asdf/installs/python/3.12.0
python-build: use openssl@3 from homebrew
python-build: use readline from homebrew
Downloading Python-3.12.0.tar.xz...
-> https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz
Installing Python-3.12.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.12.0 to /Users/[REDACTED]/.asdf/installs/python/3.12.0
$ python
Python 3.12.0 (main, Oct 2 2023, 15:38:53) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils' |
Hi @nikolay , have you installed |
@abravalheri So, with 3.12+, do I have to install |
Yes, to use Setuptools' copy of distutils, you need to install setuptools and setuptools is not part of the stdlib.
Not sure what we can do about that in the context of the setuptools github project. Maybe you should contact the Python project instead? |
Read What’s New In Python 3.12:
|
I confirm that the bug is fixed:
Thanks for the fix! |
Bump to 3.12 in python:latest causes some distutils dependency issues that are yet to be resolved in the upstream image. See: pypa/setuptools#3661 for more information. Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
Experiencing same issue on chdb pipeline. Fixed by |
setuptools version
65.5.0
Python version
3.12 (dev, without distutils)
OS
Linux
Additional environment information
No response
Description
I just removed the distutils packages from Python 3.12: commit. setuptools works as expected, it provides its copy of distutils. Good.
But if pip is imported first,
import setuptools
orimport distutils
fails on import setuptools, since _distutils_hack has a special path when pip is installed which requires to get the stdlib distutils... which no longer exists.Extract of
_distutils_hack/__init__.py
:See pypa/pip#8761 for the rationale.
Well, this special case should be revisited for Python >= 3.12.0 alpha 2.
Expected behavior
Importing setuptools on Python 3.12 after pip was imported should just work.
How to Reproduce
Output
The text was updated successfully, but these errors were encountered: