ozen / PyOptiX

Python wrapper for NVIDIA OptiX Ray Tracing Engine
MIT License
64 stars 7 forks source link

PyOptix on Windows #2

Open peggers opened 7 years ago

peggers commented 7 years ago

Hej! I cannot make PyOptix run on Windows. Can anyone give me a hint which things I have to change to make it run?

ozen commented 7 years ago

Do you get an error during compile time or run time? What is the error?

On Sat, Apr 8, 2017, 3:09 PM peggers notifications@github.com wrote:

Hej! I cannot make PyOptix run on Windows. Can anyone give me a hint which things I have to change to make it run?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ozen/PyOptiX/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA-mUbcZl3APbdTC6C0T8StBjMWXfkVks5rt3kIgaJpZM4M3r2i .

peggers commented 7 years ago

http://stackoverflow.com/questions/43300055/installation-failure-cannot-find-startupinfo This is the problem I got on Windows. I installed Ubuntu now and am at the stage when I install the Optix SDK. How do I put nvcc in PATH and how do I put the libraries in ldconfig? I have some basic ubuntu knowledge, but it is unfortunately a bit rusty.

ozen commented 7 years ago

Seeing the error has refreshed my memory. setup.py script runs linux-specific commands to find the dependencies. So it fails in Windows straight away.

As for paths to dependencies in Linux, CUDA, OptiX, and Boost.Python are required during compilation, and they are searched using ldconfig and LD_LIBRARY_PATH. ldconfig is a program that is used to manage shared libraries. LD_LIBRARY_PATH is an environment variable which you set to give the library loader (ld.so) an extra set of directories to look for when searching for shared libraries. Path to nvcc binary must be in PATH. PATH is an environment variable specifying a set of directories where executable programs are located. So if you run nvcc, the operating system will search nvcc binary in those directories. It is required to PyOptiX's PTX generation feature to work and is located and saved in a conf file during the setup.

When you install Boost.Python using Ubuntu's package manager, it will probably configure ldconfig automatically so you don't need to worry about that. Since you probably install CUDA and OptiX manually, lets add their paths to the environment variables. I have written the following commands assuming:

If you put them somewhere else, either create symlinks, or change the following commands accordingly.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/optix/lib64
export PATH=$PATH:/usr/local/cuda/bin

Edit: These paths may be used during run time as well. export command changes the environment variables for that session only. To make them persistent you need to modify a profile file. Please check out this web page, specifically Persistent environment variables section to learn more about environment variables in Ubuntu.

peggers commented 7 years ago

Ok, thank you very much for the the good explanation. Indeed I installed Optix to somewhere else, but created a symlink. by running echo $LD_LIBRARY_PATH and echo $PATH I can see, that the variables are added. But then, while installing PyOptiX, it cannot find nvcc: sudo python setup.py install Traceback (most recent call last): File "setup.py", line 193, in <module> main() File "setup.py", line 156, in main sources, include_dirs, library_dirs, libraries = extension_prebuild() File "setup.py", line 105, in extension_prebuild raise OSError('nvcc is not in PATH') OSError: nvcc is not in PATH

peggers commented 7 years ago

Ok, I think managed to install it. But now I face some problems running the examples. Running hello.py with python (2.7) gives me this output python hello.py

Traceback (most recent call last):
  File "hello.py", line 8, in <module>
    from examples.common import ImageWindow
ImportError: No module named examples.common

and with python 3:

Traceback (most recent call last):
  File "hello.py", line 7, in <module>
    from pyoptix import Context, Buffer, Program, EntryPoint, Compiler
  File "/usr/local/lib/python3.5/dist-packages/pyoptix/__init__.py", line 1, in <module>
    from .acceleration import Acceleration
  File "/usr/local/lib/python3.5/dist-packages/pyoptix/acceleration.py", line 2, in <module>
    from pyoptix.context import current_context
  File "/usr/local/lib/python3.5/dist-packages/pyoptix/context.py", line 3, in <module>
    from pyoptix._driver import NativeContextWrapper
ImportError: dynamic module does not define module export function (PyInit__driver)
ozen commented 7 years ago

Python 3 problem seems like the extension has not been compiled correctly for Python 3. Python 2 problem may be my mistake, I will look into it as soon as possible. In the meantime, try running the following commands in pyoptix directory:

python examples/hello/hello.py

or

python -m examples.hello.hello