VFX-UsdAssetResolver icon indicating copy to clipboard operation
VFX-UsdAssetResolver copied to clipboard

Use CachedResolver outside of Houdini

Open gregoiredelzongle opened this issue 8 months ago • 3 comments

Hi, Thank you again for your resolver, it works perfectly in our pipeline and we already use it in production.

I'm trying to use the resolver outside of Houdini in a python script, on windows :

  • I injected all the required environnement variables (PYTHONPATH,PXR_PLUGINPATH_NAME, and PATH before running my script) Here is the error I get :
Traceback (most recent call last):
  File "run_karma.py", line 164, in <module>
    main(load_soft(*sys.argv[1:]))
  File "run_karma.py", line 34, in main
    from usdAssetResolver import CachedResolver
  File "...\usd\cachedResolver\lib\python\usdAssetResolver\CachedResolver\__init__.py", line 2, in <module>
    Tf.PreparePythonModule()
  File "...\site-packages\pxr\Tf\__init__.py", line 103, in PreparePythonModule
    module = importlib.import_module(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\.uv\python\cpython-3.11.7-windows-x86_64-none\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing _cachedResolver: Le module spécifié est introuvable.
Traceback (most recent call last):

Any clues from your end ?

Have a nice day

gregoiredelzongle avatar Mar 31 '25 08:03 gregoiredelzongle

Hey, thanks for checking out/using the resolver.

Are you calling

from pxr import Ar
from usdAssetResolver import CachedResolver

or just:

from usdAssetResolver import CachedResolver

?

LucaScheller avatar Apr 01 '25 03:04 LucaScheller

I use

from pxr import Ar
from usdAssetResolver import CachedResolver

I'm not using houdini python executable, but my own python (which is the same version though) with usd-core:24.3 python package.

gregoiredelzongle avatar Apr 01 '25 07:04 gregoiredelzongle

OK I managed to make it work by using C:\Program Files\Side Effects Software\Houdini 20.5.445\python311\python3.11.exe for my script, adding my own libraries using site.addsitedir('path/to/my/module') and also adding os.add_dll_directory("C:/Program Files/Side Effects Software/Houdini 20.5.445/bin") to make pxr module not crash.

I'm unsure if I must do that, I'd rather use my own python with dependencies, to avoid dependencies conflict. Tell me if you have any thoughts about it !

gregoiredelzongle avatar Apr 01 '25 11:04 gregoiredelzongle

Hey, sorry for not getting back to this again.

Some more thoughts:

  • Is the python version an exact match?
  • Are you compiling USD (and boost pre USD 24.11) yourself as well? If not, there might be lib mismatches.

Do you still need debugging help or can we mark this as resolved?

LucaScheller avatar Sep 04 '25 01:09 LucaScheller

I've compiled it myself and managed to make it work :)

gregoiredelzongle avatar Sep 06 '25 08:09 gregoiredelzongle

Great, I'll close this for now then :)

LucaScheller avatar Sep 06 '25 18:09 LucaScheller