Help with otk-pyoptix

Hello.

I am looking to use the Optix Python bindings from

The installation is
Windows 11 24H2
CUDA - 12.9 - 576
Optix - 9.0.0

The optix module version 0.0.1 builds and installs.

But running python hello.py example results in

Traceback (most recent call last):
  File "C:\********\otk-pyoptix\examples\hello.py", line 8, in <module>
    import optix
ImportError: DLL load failed while importing optix: The specified module could not be found.

I installed the 12* version of the cupy and cuda-python and cuda-bindings python packages, latest ones are 13*. I am assuming they are in sync with the CUDA releases.

Also the README suggests pip install pynvrtc. There is no package by that name but there is a nvidia-cuda-nvrtc

Here is the output of pip list

Package                Version
---------------------- -------
colorama               0.4.6
cuda-bindings          12.9.2
cuda-pathfinder        1.3.0
cuda-python            12.9.2
cupy-cuda12x           13.6.0
fastrlock              0.8.3
iniconfig              2.1.0
numpy                  2.3.3
nvidia-cuda-nvrtc-cu12 12.9.86
optix                  0.0.1
packaging              25.0
pillow                 11.3.0
pip                    25.2
pluggy                 1.6.0
Pygments               2.19.2
pytest                 8.4.2
pywin32                311

Thank you for reading and for you help.
Let me know if you need more information.

Cheers

Update.

I shifted theimport optix line below the

import cupy  as cp    # CUDA bindings
import numpy as np    # Packing of structures in C-compatible format
import optix

and it is working as expected. showing the green square, and the other examples also need to be modified to work

running import optix on the command line interpreter gives this

>>> import optix
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    import platform
    ^^^^^^^^^^^^
ImportError: DLL load failed while importing optix: The specified module could not be found.

And

import cupy
import optix

does not error out.

Cheers

1 Like

Also, the following

from signal import default_int_handler
from telnetlib import DEBUGLEVEL

in curves.py, can be removed

Thanks for bringing this to our attention. I am not sure why CUPY or NUMPY import prior to optix import would be necessary as optix should not rely on them. And the failure to import platform is strange as well as this is a built-in module. I will look into this.

1 Like

Hello …

glad to be of help!

Also, this is not required. (it is mentioned in the README)

pip install pynvrtc

Since the examples import nvrtc from cuda_bindings

Cheers

Hello again.

VSCode is not able to autocomplete the module contents, while it is able to autocomplete cupy. I think this is because there is no init.py` in the module. It is a bit annoying to go back and forth to look at the function names or struct names.

Could an __init__.py be added / created.

Cheers and Thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.