uci-rendering / psdr-cuda

Path-space differentiable renderer
BSD 3-Clause "New" or "Revised" License
155 stars 11 forks source link

Unable to import psdr_cuda #23

Closed JakeXin7 closed 2 years ago

JakeXin7 commented 2 years ago

Hello and thanks for sharing your work!

I cannot find any package or module named psdr_cuda after compiling the system. I can only find one pyd file in psdr-cuda\build\lib\Release(or psdr-cuda\build\lib) named psdr_cuda.cp39-win_amd64.pyd. I wonder if this is the right result after compiling? Did I make any mistake while compiling the system?

andyyankai commented 2 years ago

This seems to be correct. Have you add psdr-cuda\build\lib\Release to your python path? Also, make sure enoki build is also in your python path

JakeXin7 commented 2 years ago

Yeah, I did. And I also tried:

import sys import os sys.path.append('D:/study/CG/psdr-cuda/build/lib') os.environ['path'] += ';D:/study/CG/psdr-cuda/build/lib' import psdr_cuda

to import psdr_cuda, but it didn't work.

JakeXin7 commented 2 years ago

The error is:

ImportError: DLL load failed while importing psdr_cuda: The specified module could not be found.

andyyankai commented 2 years ago

I just make an update, can you pull and rerun?

JakeXin7 commented 2 years ago

I pull and rerun the system, but errors still occur. I got some warning while compiling. Did these warnings matter?

D:\study\CG\psdr-cuda\src\core\miniz.cpp(2430,143): warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits [D:\study\CG\psdr-cuda\build\psdr_cuda.vcxproj] D:\study\CG\psdr-cuda\include\psdr/core/tinyexr.h(2449,39): warning C4018: '<' : signed/unsigned mismatch (D:\study\CG\psdr-cuda\src\core\bitmap_loader.cpp) [D:\study\CG\psdr-cuda\build\psdr_cuda.vcxproj] D:\study\CG\psdr-cuda\include\psdr/core/tinyexr.h(2712,35):warning C4018: '<' : signed/unsigned mismatch (D:\study\CG\psdr-cuda\src\core\bitmap_loader.cpp) [D:\study\CG\psdr-cuda\build\psdr_cuda.vcxproj] D:\study\CG\psdr-cuda\src\optix\ptx.cpp(94,1): warning C4273: “psdr::getPtxString”: inconsistent dll linkage [D:\study\CG\psdr-cuda\build\psdr_cuda.vcxproj] D:\study\CG\psdr-cuda\include\psdr/scene/optix.h(271,59): warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data (D:\study\CG\psdr-cuda\src\scene\scene_optix.cpp) [D:\study\CG\psdr-cuda\build\psdr_cuda.vcxproj]

andyyankai commented 2 years ago

warnings are fine. Are you able to import enoki?

andyyankai commented 2 years ago

gonna sleep, remember to double-check if enoki is in your PATH and PYTHON PATH. Here is a guide: https://docs.oracle.com/en/database/oracle/machine-learning/oml4r/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html

JakeXin7 commented 2 years ago

I fix the problem by change the interpreter from python of Windows to a virtual environment created by Anaconda! (But I don't know why it helps) Thanks for help!

andyyankai commented 2 years ago

one possible reason is that you are using python3.9, while the default enoki precompiled pkg is python3.8

xdobetter commented 2 years ago

This seems to be correct. Have you add psdr-cuda\build\lib\Release to your python path? Also, make sure enoki build is also in your python path

In windows10,After successful compilation,I add the Python path(psdr-cuda,enoki),but it doesn't work.Did I add it the wrong way?

# In run_test.py
import sys
sys.path.append(r'D:\C++Program\psdr-cuda\ext_win64\enoki\lib') 
sys.path.append(r'D:\C++Program\psdr-cuda\build\lib\Release') 

i2