PixarAnimationStudios / OpenUSD

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

Build 19.05 in Windows succeed but unable to run #1220

Closed tufeixp closed 4 years ago

tufeixp commented 4 years ago

Description of Issue

Build 19.05 with python 2.7 unable to import usd module after build on my pc. Build dev with the same problem. However, this bin downloaded from https://developer.nvidia.com/usd-binary-windows-python-2.7 works! Why?

Steps to Reproduce

d:\Github\USD>python build_scripts\build_usd.py --build-monolithic --alembic --openimageio D:\Github\build\usd

Building with settings: USD source directory d:\Github\USD USD install directory D:\Github\build\usd 3rd-party source directory D:\Github\build\usd\src 3rd-party install directory D:\Github\build\usd Build directory D:\Github\build\usd\build CMake generator Default Downloader curl

Building Monolithic shared library Config Release Imaging On Ptex support: Off OpenImageIO support: On OpenColorIO support: Off UsdImaging On usdview: On Python support On Documentation Off Tests Off Alembic Plugin On HDF5 support: Off MaterialX Plugin Off Maya Plugin Off Katana Plugin Off Houdini Plugin Off

Dependencies OpenImageIO STATUS: Installing OpenImageIO... STATUS: Installing USD...

Success! To use USD, please ensure that you have:

The following in your PYTHONPATH environment variable:
D:\Github\build\usd\lib\python

The following in your PATH environment variable:
D:\Github\build\usd\bin
D:\Github\build\usd\lib

D:\Github\build\usd\share\usd\tutorials\helloWorld>python helloWorld.py Traceback (most recent call last): File "helloWorld.py", line 26, in from pxr import Usd, UsdGeom File "D:\Github\build\usd\lib\python\pxr\Usd__init__.py", line 24, in import _usd ImportError: DLL load failed

System Information (OS, Hardware)

windows 10 visual studio 2017 python 2.7

Package Versions

Build Flags

image image image


I tried to build with non Monolithic version and the helloworld.py runs ok, however with several dlls still not found in deep dependencies path: image

grische commented 4 years ago

@tufeixp Did forget to specify the PATH manually? Basically something like this:

set PATH=%PATH%;D:\Github\build\usd\lib\
set PATH=%PATH%;D:\Github\build\usd\bin\

My _usd.pyd has a dependency on python27.dll, similar to yours.

So, after I set PYTHONPATH and both the PATH above, it works fine with Python27 for me:

> C:\Python27\python.exe share\usd\tutorials\helloWorld\helloWorld.py
> dir /B HelloWorld.usda
HelloWorld.usda

But it does not work for Python38:

> C:\Python38\python.exe share\usd\tutorials\helloWorld\helloWorld.py
Traceback (most recent call last):
  File "share\usd\tutorials\helloWorld\helloWorld.py", line 26, in <module>
    from pxr import Usd, UsdGeom
  File "C:\Downloads\usd-win64\lib\python\pxr\Usd\__init__.py", line 24, in <module>
    from . import _usd
ImportError: DLL load failed while importing _usd: The specified module could not be found.

Are you sure that you are using python 2.7? Just run python.exe -V to be sure.

jtran56 commented 4 years ago

Filed as internal issue #USD-6086.

tufeixp commented 4 years ago

@tufeixp Did forget to specify the PATH manually? Basically something like this:

set PATH=%PATH%;D:\Github\build\usd\lib\
set PATH=%PATH%;D:\Github\build\usd\bin\

My _usd.pyd has a dependency on python27.dll, similar to yours.

So, after I set PYTHONPATH and both the PATH above, it works fine with Python27 for me:

> C:\Python27\python.exe share\usd\tutorials\helloWorld\helloWorld.py
> dir /B HelloWorld.usda
HelloWorld.usda

But it does not work for Python38:

> C:\Python38\python.exe share\usd\tutorials\helloWorld\helloWorld.py
Traceback (most recent call last):
  File "share\usd\tutorials\helloWorld\helloWorld.py", line 26, in <module>
    from pxr import Usd, UsdGeom
  File "C:\Downloads\usd-win64\lib\python\pxr\Usd\__init__.py", line 24, in <module>
    from . import _usd
ImportError: DLL load failed while importing _usd: The specified module could not be found.

Are you sure that you are using python 2.7? Just run python.exe -V to be sure.

I was trying to build it with python 2.7, and of 'cause I have the path set. No luck for me, the Monolithic version just can't run.

sunyab commented 4 years ago

I'm also unable to reproduce this issue. I've created a monolithic USD build with your command line using MSVC 2017 and Python 2.7 and was able to run the tutorial script successfully. DependenciesGui also showed me similar results to yours.

I would double check that you've specified both PATH and PYTHONPATH as indicated by the build script. If that still doesn't work, I would suggest trying to build the most recent version of USD to see if that works for you.

tufeixp commented 4 years ago

I tried again with 19.05 and dev, and still with the same problem. D:\Github\USD>python build_scripts\build_usd.py --build-monolithic --alembic --openimageio D:\Github\build\usd2monolithic

Building with settings: USD source directory D:\Github\USD USD install directory D:\Github\build\usd2monolithic 3rd-party source directory D:\Github\build\usd2monolithic\src 3rd-party install directory D:\Github\build\usd2monolithic Build directory D:\Github\build\usd2monolithic\build CMake generator Default Downloader curl

Building Monolithic shared library Config Release Imaging On Ptex support: Off OpenImageIO support: On OpenColorIO support: Off UsdImaging On usdview: On Python support On Documentation Off Tests Off Alembic Plugin On HDF5 support: Off MaterialX Plugin Off Maya Plugin Off Katana Plugin Off Houdini Plugin Off

Dependencies None STATUS: Installing USD...

Success! To use USD, please ensure that you have:

The following in your PYTHONPATH environment variable:
D:\Github\build\usd2monolithic\lib\python

The following in your PATH environment variable:
D:\Github\build\usd2monolithic\bin
D:\Github\build\usd2monolithic\lib

D:\Github\build\usd2monolithic\share\usd\tutorials\helloWorld>python helloWorld.py Traceback (most recent call last): File "helloWorld.py", line 26, in from pxr import Usd, UsdGeom File "D:\Github\build\usd2monolithic\lib\python\pxr\Usd__init__.py", line 24, in import _usd ImportError: DLL load failed

path: PYTHONPATH=D:\Github\build\usd2monolithic\lib\python __VSCMD_PREINIT_PATH=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;D:\Program Files\python27\Scripts\;D:\Program Files\python27\;C:\Program Files\Microsoft HPC Pack 2008 R2\Bin\;d:\MSC.Software\Patran_x64\20180\bin;D:\Program Files\Python\Python37\Scripts\;D:\Program Files\Python\Python37\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Hjimi\ImiSDK\3rdparty\lib\Win32\;D:\Program Files (x86)\Hjimi\ImiSDK\Redist\Win32\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;D:\Program Files\Microsoft VS Code\bin;C:\Program Files\dotnet\;C:\Program Files\Common Files\Autodesk Shared\;D:\Program Files (x86)\MiddleVR\bin;D:\Program Files (x86)\MiddleVR\bin64;C:\Program Files\Perforce\;d:\SIMULIA\Abaqus\Commands;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Pandoc\;D:\Program Files\HoloPlayCAPI;D:\Program Files\Simulated Reality\SDK 1.1\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;D:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\inference_engine\bin\intel64\Release;D:\Program Files\CMake\bin;C:\Program Files\NASM;D:\Github\build\usd2monolithic\bin;D:\Github\build\usd2monolithic\lib;D:\Program Files\python27\include;C:\Users\wz.cargo\bin;C:\Users\wz\AppData\Local\Microsoft\WindowsApps;C:\Users\wz\AppData\Local\GitHubDesktop\bin;C:\Users\wz\AppData\Local\Microsoft\WindowsApps;D:\Program Files (x86)\CMake\bin;D:\Program Files\Simulated Reality\SDK 1.1\bin;D:\Program Files (x86)\swigwin-3.0.12;

Python Version: Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32

D:\Github\build\usd2monolithic\share\usd\tutorials\helloWorld>pip show pyside DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Name: PySide Version: 1.2.4 Summary: Python bindings for the Qt cross-platform application and UI framework Home-page: http://www.pyside.org Author: PySide Team Author-email: contact@pyside.org License: LGPL Location: d:\program files\python27\lib\site-packages Requires: Required-by:

D:\Github\build\usd2monolithic\share\usd\tutorials\helloWorld>pip show pyopengl DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Name: PyOpenGL Version: 3.1.5 Summary: Standard OpenGL bindings for Python Home-page: http://pyopengl.sourceforge.net Author: Mike C. Fletcher Author-email: mcfletch@vrplumber.com License: BSD Location: d:\program files\python27\lib\site-packages Requires: Required-by:

D:\Github\build\usd2monolithic\share\usd\tutorials\helloWorld>nasm -v NASM version 2.14.03rc2 compiled on Dec 30 2018

Here is on of the questioning python binary: _usd.zip

grische commented 4 years ago

@tufeixp it is hard to help without being able to reproduce. Do you need to build the source yourself? Can you use pre-built binaries like this in #1221 maybe?

tufeixp commented 4 years ago

@tufeixp it is hard to help without being able to reproduce. Do you need to build the source yourself? Can you use pre-built binaries like this in #1221 maybe?

Thanks. I was trying to build this one: https://github.com/Unity-Technologies/usd-unity-sdk, which requires a monolithic rebuild of the USD source, I can found a pre-build 1905 from nowhere, including on the Azure site you provide.

tufeixp commented 4 years ago

@tufeixp it is hard to help without being able to reproduce. Do you need to build the source yourself? Can you use pre-built binaries like this in #1221 maybe?

thanks! it works with this bin: https://github.com/VictorYudin/saturn/releases/tag/1.0.179. With only one error left when compiling usdCs project: Error LNK1104 cannot open file 'python27.lib' UsdCs D:\Github\usd-unity-sdk\usd-unity-sdk\src\UsdCs\LINK 1