Open dmolesUC opened 2 years ago
I have been doing some investigation and found that doing the simple brew install openexr
does not install the proper headers required to actually use OpenEXR :( ... You have to install ilmbase
. However, you get a message saying it conflicts with headers found in the openexr
package... ugh. So I naively just copied the headers such as ImFIO.h over to where openexr's include directory was as per https://github.com/AcademySoftwareFoundation/openexr/issues/231#issuecomment-357402189
This did not work and they are just not correctly synced or whatever. I got errors like error: virtual function 'tellg' has a different return type ('Imath_2_5::Int64' (aka 'unsigned long')) than the function it overrides (which has return type 'uint64_t' (aka 'unsigned long long'))
. This tells me that ilmbase is not the correct ilmbase for the openexr you can get through brew, so I am going to try to build openexr from source and post update here.
Alright! Installing openexr from their release 'cd openexr; mkdir build; cd build; cmake ..; make; sudo make install' got me halfway there. Then pip install openexr will still try to use that ilmbase but its is /wrong/ and does not match the current release of openexr. Just brew uninstall openexr
and also manually install the current release of lmath just like openexr. By uninstalling ilmbase, you are forcing the command:
❯ clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/tf/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/tf/include -arch arm64 -I/opt/homebrew/opt/ilmbase/include/OpenEXR -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/usr/include/Imath -I/usr/local/include/Imath -I/opt/local/include/Imath -I/opt/homebrew/Caskroom/miniforge/base/envs/tf/include/python3.10 -c OpenEXR.cpp -o build/temp.macosx-11.0-arm64-cpython-310/OpenEXR.o -g -DVERSION=\"1.3.9\" -std=c++11 -Wc++11-extensions -Wc++11-long-long
To not find your home-brewed ilmbase (see the part where it says -I/opt/homebrew/opt/ilmbase/include/OpenEXR
and will now just auto find your manually install lmath. Now running pip install openexr
works... this is more of a cask issue and don't know where this belongs but hope this helps someone.
Edit: Idk if it helped but I also made sure to do brew install zlib
per the openexr instructions
This helped: https://github.com/AcademySoftwareFoundation/openexr/blob/main/INSTALL.md And this: https://github.com/AcademySoftwareFoundation/Imath/blob/main/INSTALL.md
I found a solution just in case anyone is having trouble installing this python binding. The root cause of this is that openexr bumped to version 3+ and refactored out Imath
as a separate lib, and this binding is for version 2+.
First, install openexr@2 with home brew by:
brew install openexr@2
Then you need to clone this repo, and add the following path to setup.py
:
include_dirs : '/opt/homebrew/opt/openexr@2/include/OpenEXR/', '/opt/homebrew/opt/ilmbase/include/OpenEXR'
library_dirs : '/opt/homebrew/opt/openexr@2/lib', '/opt/homebrew/opt/ilmbase/lib'
Then you should be able to install this binding by:
pip install ./openexrpython
It's because the GCC compiler couldn't find the suitable C++ heads and libraries. To solve it, here are some tips:
First, install OpenERR from brew, brew install openexr
. For me, version 3+ works well. Here it's 3.1.7
.
Next, open the setup.py
and add those directories to the include_dirs
and library_dirs
.
include_dirs=['/usr/include/OpenEXR',
'/usr/local/include/OpenEXR',
'/opt/local/include/OpenEXR',
'/usr/include/Imath',
'/usr/local/include/Imath',
'/opt/local/include/Imath',
'/opt/homebrew/Cellar/openexr/3.1.7/include/OpenEXR', # specific to my system
'/opt/homebrew/Cellar/imath/3.1.7/include/Imath'], # specific to my system
library_dirs=['/usr/lib',
'/usr/local/lib',
'/opt/local/lib',
'/opt/homebrew/Cellar/openexr/3.1.7/lib', # specific to my system
'/opt/homebrew/Cellar/imath/3.1.7/lib'], # specific to my system
openexr
and imath
.Alternatively, you may also add those directories into system path.
brew install openexr
export CFLAGS="-I/opt/homebrew/Cellar/openexr/3.1.7/include/OpenEXR -I/opt/homebrew/Cellar/imath/3.1.7/include/Imath -std=c++11"
export LDFLAGS="-L/opt/homebrew/Cellar/openexr/3.1.7/lib -L/opt/homebrew/Cellar/imath/3.1.7/lib"
pip install OpenEXR
Enjoy🍺
System information
Steps to reproduce
pip3 install --no-cache-dir openexr
Expected
Actual