PrismPipeline / QuiltiX

QuiltiX is a graphical node editor to edit, and author MaterialX based materials of 3D assets
https://pypi.org/project/QuiltiX
Apache License 2.0
259 stars 27 forks source link

Manual Usd package path setup required #42

Closed kwokcb closed 2 months ago

kwokcb commented 9 months ago

Query

I am curious as to the recommended way to set up search paths for using Usd.

"Default" Setup

Running results in errors as the DLLS cannot be found.

Traceback (most recent call last):
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\site-packages\QuiltiX\__main__.py", line 1, in <module>
    from . import quiltix
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\site-packages\QuiltiX\quiltix.py", line 28, in <module>
    from pxr import UsdShade, Usd
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\site-packages\pxr\UsdShade\__init__.py", line 24, in <module>
    from pxr import Tf
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\Lib\site-packages\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\site-packages\pxr\Tf\__init__.py", line 164, in <module>
    PreparePythonModule()
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\site-packages\pxr\Tf\__init__.py", line 89, in PreparePythonModule
    module = importlib.import_module(
  File "C:\Users\home\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing _tf: The specified module could not be found.

Working Options

It's possible to then set the search PATH to point to either:

  1. Where the package was installed
  2. Where a user has a local install of Usd.

I'd assume for the "default" case it would be the package location. For this is it possible to make it run without setting up this manually? BTW I'm unsure if this is only with Usd 23.11 but when I upgraded QuiltiX was using my previous local install of Usd 23.08 instead. When I got rid of the paths to that distro, then startup would fail.

What is the advice on how to set things up "correctly"?

manuelkoester commented 8 months ago

Hey!

It should be enough to just add the usd libs to PATH as long as they also include the relevant usd plugins (like usdmtlx).
"Our" usd package that can be installed via pip install git+https://github.com/PrismPipeline/OpenUSD_build.git@23.11-win-mtlx-1.38.8 goes the route of adding the DLLs on python similar to how the usd-core package handles this: https://github.com/PixarAnimationStudios/OpenUSD/blob/release/build_scripts/pypi/package_files/setup.py#L85-L99

Other than that your setup should work. The error might be due to a python version mismatch for the provided compiled usd binaries?

I just successfully tried this using a fresh local python3.9 venv on windows

pip install QuiltiX
pip install git+https://github.com/PrismPipeline/OpenUSD_build.git@23.11-win-mtlx-1.38.8
python -m QuiltiX

image

manuelkoester commented 3 months ago

We should add some docs for users on how to provide their own USD.