PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.18k stars 1.23k forks source link

Importing pxr in python on Windows changes PATH which breaks Usd in subprocesses #3114

Open tbttfox opened 5 months ago

tbttfox commented 5 months ago

Description of Issue

If you import pxr in a python interpreter then launch a subprocess that has its own USD libraries (eg. Maya), the extra entry added into PATH loads the incorrect DLL's and prevents the subprocess from loading USD.

This is something that can be worked around on our end. But I really don't like that importing a module changes PATH. It looks like this only happens on Windows, and is only added to the PyPi upload to make anaconda work

The PATH change happens here: build_scripts/pypi/package_files/setup.py

Steps to Reproduce

  1. Open a python interpreter
  2. import pxr, subprocess
  3. subprocess.Popen(r'C:\Program Files\Autodesk\Maya2024\bin\maya.exe')
  4. Load mayaUsdPlugin.mll
  5. Note the error. It will be something like this:
    // Error: file: C:/Program Files/Autodesk/Maya2024/scripts/others/pluginWin.mel line 316: Unable to dynamically load : C:/Program Files/Autodesk/MayaUSD/Maya2024/0.25.0/mayausd/MayaUSD/plugin/adsk/plugin/mayaUsdPlugin.mll
    // The specified procedure could not be found.
    // Error: file: C:/Program Files/Autodesk/Maya2024/scripts/others/pluginWin.mel line 316: The specified procedure could not be found.
    //  (mayaUsdPlugin)

    System Information (OS, Hardware)

    Windows 10

Package Versions

System Python USD version: 0.24.5 Maya Python USD version: 0.22.11 MayaUSD version 0.25.0 Python 3.9.12

jesschimein commented 5 months ago

Filed as internal issue #USD-9744