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

Retire distutils from Python code #3389

Open
fhechtAdobe opened this issue Nov 1, 2024 · 3 comments
Open

Retire distutils from Python code #3389

fhechtAdobe opened this issue Nov 1, 2024 · 3 comments
Labels
build Build-related issue/PR good first issue Indicates a good issue for first-time contributors help wanted Indicates an issue where help and/or a pull request from the community would be very welcome

Comments

@fhechtAdobe
Copy link

Description of Issue

The distutils module is considered deprecated and has been removed in Python 3.12. That means the OpenUSD code (v24.11) compiles against Python 3.12, but then hits a runtime error when launching usdview.

I understand that the VFX platform for CY2025 is still targeting Python 3.11.x, but this was fixed for the build script (even though this ticket about the issue was closed: #2817) and there are only two functions from distutils still in use:

from distutils.spawn import find_executable which is easily replaceable with shutil.which. And distutils.util.strtobool, which does not have a direct replacement, but should be easy. See also https://peps.python.org/pep-0632/

It would be nice to improve the Python 3.12 support by taking this small extra step. Thanks!

@nvmkuruc
Copy link
Collaborator

nvmkuruc commented Nov 1, 2024

Agree that this would be helpful. 👍

@asluk asluk added the build Build-related issue/PR label Nov 1, 2024
@nvmkuruc nvmkuruc added help wanted Indicates an issue where help and/or a pull request from the community would be very welcome good first issue Indicates a good issue for first-time contributors labels Nov 2, 2024
@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10385

@mscherotter
Copy link

mscherotter commented Jan 15, 2025

On Windows 11,

  1. I just cloned the source
  2. Ran the python build script C:\> python OpenUSD\build_scripts\build_usd.py "C:\path\to\my_usd_install_dir"
  3. Built the code in Visual Studio 2022
  4. tried to run the sample asset usdview OpenUSD/extras/usd/tutorials/convertingLayerFormats/Sphere.usda
    I got this error - it looks like there is still a dependency on distutils. Please advise:

D:\Source\openusd_install\bin>usdview D:\Source\Repos\OpenUSD\extras\usd\tutorials\convertingLayerFormats\Sphere.usda
Traceback (most recent call last):
  File "D:\Source\openusd_install\bin\usdview", line 11, in <module>
    import pxr.Usdviewq as Usdviewq
  File "d:\source\openusd_install\lib\python\pxr\Usdviewq\__init__.py", line 17, in <module>
    from .appController import AppController
  File "d:\source\openusd_install\lib\python\pxr\Usdviewq\appController.py", line 35, in <module>
    from .layerStackContextMenu import LayerStackContextMenu
  File "d:\source\openusd_install\lib\python\pxr\Usdviewq\layerStackContextMenu.py", line 13, in <module>
    from pxr.UsdUtils.toolPaths import FindUsdBinary
  File "d:\source\openusd_install\lib\python\pxr\UsdUtils\toolPaths.py", line 10, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build-related issue/PR good first issue Indicates a good issue for first-time contributors help wanted Indicates an issue where help and/or a pull request from the community would be very welcome
Projects
None yet
Development

No branches or pull requests

5 participants