Python bindings for OptiX 7.
Install any OptiX 7.x SDK.
To run the PyOptiX examples or tests, the python modules specified in PyOptiX/requirements.txt
must be installed:
- pytest
- cupy
- numpy
- Pillow
- pynvrtc
- OpenEXR
In most cases, it makes sense to setup a python environment. Below are examples of how to setup your environment via eitherConda
or venv
.
Create and activate a new virtual environment:
python3 -m venv env
source env/bin/activate
Install all dependencies:
pip install -r requirements.txt
Create an environment containing pre-requisites:
conda create -n pyoptix python numpy conda-forge::cupy pillow pytest
Activate the environment:
conda activate pyoptix
The pynvrtc
dependency, necessary for running the examples, needs to be installed via pip:
pip install pynvrtc
Point setuptools/CMake
to Optix by setting the following environment variable.
Linux:
export PYOPTIX_CMAKE_ARGS="-DOptiX_INSTALL_DIR=<optix install dir>"
Windows:
set PYOPTIX_CMAKE_ARGS=-DOptiX_INSTALL_DIR=C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.0.0
Build and install using setuptools
:
cd optix
python setup.py install
When compiling against an Optix 7.0 SDK an additional environment variable needs to be set containing a path to the system's stddef.h location. E.g.
export PYOPTIX_STDDEF_DIR="/usr/include/linux"
Run the hello
sample:
cd examples
python hello.py
If the example runs successfully, a green square will be rendered.
Test tests are using pytest
and can be run from the test directory like this:
cd test
python -m pytest