AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

[BUILD] pyopenvdb install locatiion #1802

Closed LukasDeGreve-FM closed 5 months ago

LukasDeGreve-FM commented 5 months ago

Environment

Operating System: Ubuntu 20.04 LTS Version / Commit SHA: Current master CMake Version: 3.22.1 Compiler: gcc 9.4.0

Describe the problem

I installed openvdb and the python bindings according to the build instructions, but am unable to locate where pyopenvdb is installed. I am working inside a virtual environment, but doing

import pyopenvdb

results in a ModuleNotFoundError: No module named 'pyopenvdb'

Is there any way to set the install location of pyopenvdb that I am missing?

To Reproduce

git clone git@github.com:AcademySoftwareFoundation/openvdb.git
cd openvdb
mkdir build
cd build
cmake -DOPENVDB_BUILD_PYTHON_MODULE=ON -DUSE_NUMPY=ON ..
sudo make -j$(nproc) all install 

in python:

import pyopenvdb

Additional context

I have tried importing pyopenvdb in my main python installation as well, so outside the virtual environment, but the same problem occurs there. I have also tried a different fork of openvdb with the same problem

Thanks in advance

LukasDeGreve-FM commented 5 months ago

I was able to solve the issue. There exists a flag PYOPENVDB_INSTALL_DIRECTORY that I had to set. In the end, my cmake command looked like this:

cmake -DOPENVDB_BUILD_PYTHON_MODULE=ON -DUSE_NUMPY=ON -DPYOPENVDB_INSTALL_DIRECTORY=".venv/lib/python/dist-packages .."