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

Warning on Python 3.10/Ubuntu 22.04 #1238

Closed
traversaro opened this issue Aug 24, 2022 · 6 comments · Fixed by #1508
Closed

Warning on Python 3.10/Ubuntu 22.04 #1238

traversaro opened this issue Aug 24, 2022 · 6 comments · Fixed by #1508

Comments

@traversaro
Copy link
Member

-- Found Python3: /usr/bin/python3.10 (found version "3.10.4") found components: Interpreter
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
@traversaro
Copy link
Member Author

We should change all the places where we use:

from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))

@traversaro
Copy link
Member Author

traversaro commented Sep 1, 2022

Unfortunatly the sysconfig top module does not have the same functions of distutils.sysconfig, so the change is not as trivial as attempted in #1245 . I tried a more complex version from krshrimali/pytorch@361bce4, but unfortunatly it gives different results already in Ubuntu 22.04 :

traversaro@IITICUBLAP257:~$ python3 -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
/usr/lib/python3/dist-packages
traversaro@IITICUBLAP257:~$ python3 -c "import os;import sysconfig;relative_site_packages = sysconfig.get_path('purelib').replace(sysconfig.get_path('data'), '').lstrip(os.path.sep);print(relative_site_packages)"
lib/python3.10/dist-packages

So, we need to think more about this. Probably the best thing to do is not to rely subprojects of the superbuild to use the same logic of the superbuild to detect the python installation directly, but we should specify via appopriate CMake options the Python install directory used by the superbuild, so that we can change the Python libraries installation directory with no problem.

@traversaro
Copy link
Member Author

traversaro commented Sep 1, 2022

This is required for Python 3.12 support, that is going to be released on October of 2023 .

@traversaro
Copy link
Member Author

This is required for Python 3.12 support, that is going to be released on October of 2023 .

And October 2023 arrived!

@traversaro
Copy link
Member Author

@traversaro
Copy link
Member Author

Probably the best thing to do is not to rely subprojects of the superbuild to use the same logic of the superbuild to detect the python installation directly, but we should specify via appopriate CMake options the Python install directory used by the superbuild, so that we can change the Python libraries installation directory with no problem.

That is indeed the way to go. Once we do that, we can switch to the variant proposed in that comment, as changing the installation path (as long as they are both valid) would be perfectly ok.

traversaro added a commit that referenced this issue Oct 30, 2023
As the code in some cases return slightly different results then the previous version (see #1238 (comment)), we only use it when Python >= 3.12 .
GiulioRomualdi added a commit to GiulioRomualdi/idyntree that referenced this issue Mar 24, 2024
As the code in some cases return slightly different results then the previous version (see robotology/robotology-superbuild#1238 (comment)), we only use it when Python >= 3.12. This is simar to robotology/robotology-superbuild#1511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant