python-optix icon indicating copy to clipboard operation
python-optix copied to clipboard

Compiling from source with setup.py does not copy headers

Open keckj opened this issue 3 years ago • 2 comments

Compiling from source does not copy headers:

  • python3 setup.py install does not copy include files (optix.h)
  • pip3 install . works because custom_bdist_wheel is executed in setup.py

When using setup.py, get_local_optix_include_path() returns None which results in module creation failure:

module = optix.Module(context=ctx, src=cuda_source, module_compile_options=compile_opts, pipeline_compile_options=pipeline_opts)
  File "optix/module.pyx", line 257, in optix.module.Module.__init__
  File "optix/module.pyx", line 413, in optix.module.Module.compile_cuda_ptx
  File "/usr/lib/python3.9/genericpath.py", line 19, in exists
    os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

There is warning for missing local headers that could have helped to pinpoint the problem but it is not shown because the condition triggering the warning crashes on None path (optix/module.pyx:413).

In the "From source" in the section in the README.md it is documented to use setup.py.

keckj avatar Nov 22 '22 13:11 keckj

Hey, thanks for pointing this out. I pushed a fix in "fix_#10" that should fix the problem. I also updated the README.md to clarify that pip is now a requirement for local installation as well.

mortacious avatar Nov 22 '22 14:11 mortacious

The same issue.

I found this is because that, it will search the header at os.path.join('OPTIX_PATH', '../optix/include/optix.h') or os.path.join('PATH', '../optix/include/optix.h') here, therefore change the dir name of your optix will solve this issue. That is to say, your optix dir should be like /xxx/optix, and use export OPTIX_PATH=/xxx/optix to set the environment variable.

Zanue avatar Nov 19 '24 09:11 Zanue