Skip to content
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

{Extension}: drop distutils.sysconfig, deprecated #20391

Closed
wants to merge 1 commit into from

Conversation

bluca
Copy link
Member

@bluca bluca commented Nov 17, 2021

Python is breaking backward compatibility by removing distutils.sysconfig
without providing an alternative. For now, hard-code the dist-packages
path until they provide a different solution.

Python is breaking backward compatibility by removing distutils.sysconfig
without providing an alternative. For now, hard-code the dist-packages
path until they provide a different solution.
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 17, 2021

Extension

@jiasli
Copy link
Member

jiasli commented Nov 18, 2021

The PR looks good to me.

Python is breaking backward compatibility

I think Python does provide an alternative sysconfig.get_path. It is just that Debian hasn't released their customized Python 3.10 with sysconfig.get_path patched for dist-packages.

Here is the output from official Python docker image (which is also built on Debian):

> docker run -it --rm python:3.10
Python 3.10.0 (default, Nov 17 2021, 15:26:39) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import distutils.sysconfig
<stdin>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<stdin>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
>>> import sysconfig
>>> distutils.sysconfig.get_python_lib()
'/usr/local/lib/python3.10/site-packages'
>>> sysconfig.get_path('purelib')
'/usr/local/lib/python3.10/site-packages'

The results of distutils.sysconfig.get_python_lib() and sysconfig.get_path('purelib') are the same.

@jiasli
Copy link
Member

jiasli commented Nov 18, 2021

Wait. Hard-coding it will break #12856 which depends on distutils.sysconfig.get_python_lib().

The only solution I can think of is for Debian to support their customized sysconfig.get_path.

@bluca
Copy link
Member Author

bluca commented Nov 23, 2021

Wait. Hard-coding it will break #12856 which depends on distutils.sysconfig.get_python_lib().

The only solution I can think of is for Debian to support their customized sysconfig.get_path.

ok, closing for now

@bluca bluca closed this Nov 23, 2021
@bebound
Copy link
Contributor

bebound commented Nov 22, 2023

Wait. Hard-coding it will break #12856 which depends on distutils.sysconfig.get_python_lib().

The only solution I can think of is for Debian to support their customized sysconfig.get_path.

distutils is dropped in 3.12, we need to reconsider this.

AFAIS, sysconfig.get_path works well.

@jiasli
Copy link
Member

jiasli commented Jul 25, 2024

With the official Azure CLI MSI package, distutils.sysconfig.get_python_lib() on Windows returns C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages:

> & "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe" -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())"
C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages

With the official Azure CLI ZIP package, distutils.sysconfig.get_python_lib() returns something like D:\tools\azure-cli\Lib\site-packages:

> D:\tools\azure-cli\python.exe -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())"
D:\tools\azure-cli\Lib\site-packages

With the official Azure CLI DEB package, distutils.sysconfig.get_python_lib() on Ubuntu/Debian returns /opt/az/lib/python3.11/site-packages.

$ /opt/az/bin/python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())"
/opt/az/lib/python3.11/site-packages

Hard-coding it to /usr/lib/python3/dist-packages breaks all Azure CLI packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants