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

fix for importing pxr.Tf on windows anaconda 3.8+ interpreters #1642

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,15 @@ platforms to avoid issues with Boost config files (introduced in Boost version
to use Boost specified config files for their USD build, specify
-DBoost_NO_BOOST_CMAKE=OFF when running cmake.

2. Windows and Python 3.8+
2. Windows and Python 3.8+ (non-Anaconda)
Python 3.8 and later on Windows will no longer search PATH for DLL dependencies.
Instead, clients can call `os.add_dll_directory(p)` to set paths to search.
By default on that platform USD will iterate over PATH and add all paths using
`os.add_dll_directory()` when importing Python modules. Users may override
this by setting the environment variable `PXR_USD_WINDOWS_DLL_PATH` to a PATH-like
string. If this is set, USD will use these paths instead.

Note that the above does not apply to Anaconda python 3.8+ interpreters, as they
are modified to behave like pre-3.8 python interpreters, and so continue to use
the PATH for DLL dependencies. When running under Anaconda users should
configure their system the same way they did for pre-python 3.8.
11 changes: 9 additions & 2 deletions build_scripts/pypi/package_files/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ def windows():
dllPath = os.path.split(os.path.realpath(__file__))[0]
if sys.version_info >= (3, 8, 0):
os.environ['PXR_USD_WINDOWS_DLL_PATH'] = dllPath
else:
os.environ['PATH'] = dllPath + os.pathsep + os.environ['PATH']
# Note that we ALWAYS modify the PATH, even for python-3.8+. This is because:
# - Anaconda python interpreters are modified to use the old, pre-3.8, PATH-
# based method of loading dlls
# - extra calls to os.add_dll_directory won't hurt these anaconda
# interpreters
# - similarly, adding the extra PATH entry shouldn't hurt standard python
# interpreters
# - there's no canonical/bulletproof way to check for an anaconda interpreter
os.environ['PATH'] = dllPath + os.pathsep + os.environ['PATH']
''')

# Get the readme text
Expand Down