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

usd-core failing on Windows + conda env + py3.9 #1602

Closed
Caenorst opened this issue Aug 26, 2021 · 4 comments
Closed

usd-core failing on Windows + conda env + py3.9 #1602

Caenorst opened this issue Aug 26, 2021 · 4 comments

Comments

@Caenorst
Copy link

Caenorst commented Aug 26, 2021

Description of Issue

Hi, I tested on two different machines to install and import usd-core pypi package and it's failing with the following logs:

test_usd.py:21: in <module>
    from pxr import Usd, UsdGeom
C:\Users\myusername\Anaconda3\envs\kaolin_release\lib\site-packages\usd_core-21.8-py3.9-win-amd64.egg\pxr\Usd\__init__.py:24: in <module>
    from pxr import Tf
C:\Users\myusername\Anaconda3\envs\kaolin_release\lib\site-packages\usd_core-21.8-py3.9-win-amd64.egg\pxr\Tf\__init__.py:163: in <module>
    PreparePythonModule()
C:\Users\myusername\Anaconda3\envs\kaolin_release\lib\site-packages\usd_core-21.8-py3.9-win-amd64.egg\pxr\Tf\__init__.py:88: in PreparePythonModule
    module = importlib.import_module(
C:\Users\myusername\Anaconda3\envs\kaolin_release\lib\importlib\__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ImportError: DLL load failed while importing _tf: The specified module could not be found.

Remarks

On the same machine there is no problem with virtualenv, neither with python version 3.7.

Steps to Reproduce

  1. Install conda
  2. Make a conda environment with python 3.9 (I believe it's also failing on 3.8)
conda create -n myenv python=3.9
conda activate myenv
  1. pip install usd-core
  2. python -c "from pxr import Usd, UsdGeom"

System Information (OS, Hardware)

Windows 10

Package Versions

usd-core == 21.8
conda, python == 3.9

@rstelzleni
Copy link
Contributor

rstelzleni commented Aug 26, 2021

Starting with python 3.8 on Windows the logic for finding dlls in the path changed. We had written code to handle this for the python packages, but it sounds like conda is exposing some flaw in that solution. I'm able to reproduce this in Windows conda, with the python 3.8 and 3.9 packages.

@rstelzleni
Copy link
Contributor

rstelzleni commented Aug 26, 2021

I haven't been able to completely get to the bottom of this yet, but I can report that setting the environment variable CONDA_DLL_SEARCH_MODIFICATION_ENABLE to 1 makes the package work for me. Just randomly googling that env var, it seems like some packages work when this is set but others may not. So, your mileage may vary, but this could be a way to get this working while we look for a permanent fix.

@jilliene
Copy link

Filed as internal issue #USD-6866

pmolodo added a commit to pmolodo/OpenUSD that referenced this issue Oct 5, 2021
cpython changed the way the dlls are loaded on windows for python-3.8+.
USD implemented a workaround for this change, installed into
pxr.__init__ (and Tf.__init__).  However, anaconda python interpreters
were patched to behave more like pre-3.8:

   https://github.com/conda-forge/python-feedstock/blob/8195ba1178041b7461238e8c5680eee62f5ea9d0/recipe/patches/0020-Add-CondaEcosystemModifyDllSearchPath.patch#L37

So we now check for anaconda interpreters before using the 3.8+ only
fix.

Fixes issue PixarAnimationStudios#1602
lkerley pushed a commit to imageworks/USD that referenced this issue Jan 7, 2022
cpython changed the way the dlls are loaded on windows for python-3.8+.
USD implemented a workaround for this change, installed into
pxr.__init__ (and Tf.__init__).  However, anaconda python interpreters
were patched to behave more like pre-3.8:

   https://github.com/conda-forge/python-feedstock/blob/8195ba1178041b7461238e8c5680eee62f5ea9d0/recipe/patches/0020-Add-CondaEcosystemModifyDllSearchPath.patch#L37

So we now check for anaconda interpreters before using the 3.8+ only
fix.

Fixes issue PixarAnimationStudios#1602
@sunyab
Copy link
Contributor

sunyab commented Apr 22, 2022

Closing out old issue, this should be addressed by #1642 which was merged in the 22.03 release.

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

No branches or pull requests

4 participants