AcademySoftwareFoundation / openexr

The OpenEXR project provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the motion picture industry.
http://www.openexr.com/
BSD 3-Clause "New" or "Revised" License
1.62k stars 609 forks source link

Building OpenEXR with Python bindings #1804

Open szalpal opened 2 weeks ago

szalpal commented 2 weeks ago

Hi,

I'm having hard time building OpenEXR with Python bindings properly. I'm running the following:

$ pybind11_DIR=~/.pyenv/versions/3.12.4/lib/python3.12/site-packages/pybind11/share/cmake/pybind11 cmake -D OPENEXR_BUILD_PYTHON=ON -D OPENEXR_BUILD_LIBS=ON -D BUILD_TESTING=ON -D  OPENEXR_TEST_PYTHON=ON ..
$ sudo make install

However, when running this in Python, looks like the module is not populated properly:

$ python
Python 3.12.4 (main, Aug 22 2024, 13:31:44) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenEXR
>>> OpenEXR.Channel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'OpenEXR' has no attribute 'Channel'

Could you advice, what's the proper way?

cary-ilm commented 2 weeks ago

One possibility is that your PYTHONPATH is not properly locating the module that you've just built. Can you print OpenEXR.__file__ to confirm where the module is loading from?

The OpenEXR.Channel object was recently added to the main branch but hasn't made it into a release yet, so after you confirm that you're loading the module you just built, can you confirm you're building from the main branch?