openexrpython
openexrpython copied to clipboard
Installation problems
When I try to install OpenEXR via pip I get the error shown below. Any recommendations on how to resolve this?
Edit: I forgot to mention:
- MacOS 10.14.6
- Python 3.7.7
- clang version 11.0.0 (clang-1100.0.33.17)
- zlib 1.2.11
- openexr 2.4.1
~ ❯❯❯ pip3 install openexr
Collecting openexr
Using cached OpenEXR-1.3.2.tar.gz (10 kB)
Building wheels for collected packages: openexr
Building wheel for openexr (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"'; __file__='"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-wheel-6zbe5i9b
cwd: /private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/
Complete output (41 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
copying Imath.py -> build/lib.macosx-10.14-x86_64-3.7
running build_ext
building 'OpenEXR' extension
creating build/temp.macosx-10.14-x86_64-3.7
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c OpenEXR.cpp -o build/temp.macosx-10.14-x86_64-3.7/OpenEXR.o -g -DVERSION="1.3.2"
In file included from OpenEXR.cpp:40:
In file included from /usr/local/include/OpenEXR/ImfAttribute.h:48:
In file included from /usr/local/include/OpenEXR/ImfXdr.h:108:
/usr/local/include/OpenEXR/half.h:99:15: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half () = default; // no initialization
^
/usr/local/include/OpenEXR/half.h:102:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
~half () = default;
^
/usr/local/include/OpenEXR/half.h:103:27: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half (const half &) = default;
^
/usr/local/include/OpenEXR/half.h:104:16: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
half (half &&) noexcept = default;
^
/usr/local/include/OpenEXR/half.h:104:19: error: expected ';' at end of declaration list
half (half &&) noexcept = default;
^
;
/usr/local/include/OpenEXR/half.h:124:43: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half & operator = (const half &h) = default;
^
/usr/local/include/OpenEXR/half.h:125:31: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
half & operator = (half &&h) noexcept = default;
^
/usr/local/include/OpenEXR/half.h:125:35: error: expected ';' at end of declaration list
half & operator = (half &&h) noexcept = default;
^
;
6 warnings and 2 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for openexr
Running setup.py clean for openexr
Failed to build openexr
Installing collected packages: openexr
Running setup.py install for openexr ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"'; __file__='"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-record-7al_kvzq/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/openexr
cwd: /private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/
Complete output (41 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
copying Imath.py -> build/lib.macosx-10.14-x86_64-3.7
running build_ext
building 'OpenEXR' extension
creating build/temp.macosx-10.14-x86_64-3.7
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c OpenEXR.cpp -o build/temp.macosx-10.14-x86_64-3.7/OpenEXR.o -g -DVERSION="1.3.2"
In file included from OpenEXR.cpp:40:
In file included from /usr/local/include/OpenEXR/ImfAttribute.h:48:
In file included from /usr/local/include/OpenEXR/ImfXdr.h:108:
/usr/local/include/OpenEXR/half.h:99:15: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half () = default; // no initialization
^
/usr/local/include/OpenEXR/half.h:102:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
~half () = default;
^
/usr/local/include/OpenEXR/half.h:103:27: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half (const half &) = default;
^
/usr/local/include/OpenEXR/half.h:104:16: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
half (half &&) noexcept = default;
^
/usr/local/include/OpenEXR/half.h:104:19: error: expected ';' at end of declaration list
half (half &&) noexcept = default;
^
;
/usr/local/include/OpenEXR/half.h:124:43: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
half & operator = (const half &h) = default;
^
/usr/local/include/OpenEXR/half.h:125:31: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
half & operator = (half &&h) noexcept = default;
^
/usr/local/include/OpenEXR/half.h:125:35: error: expected ';' at end of declaration list
half & operator = (half &&h) noexcept = default;
^
;
6 warnings and 2 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"'; __file__='"'"'/private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-install-_nhnanva/openexr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/xh/vt7q8pbj61xdnmm3b5s1nxph0000gn/T/pip-record-7al_kvzq/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/openexr Check the logs for full command output.
~ ❯❯❯
With zlib
and openexr
installed via brew:
~ ❯❯❯ brew info zlib
zlib: stable 1.2.11 (bottled) [keg-only]
General-purpose lossless data-compression library
https://zlib.net/
/usr/local/Cellar/zlib/1.2.11 (12 files, 373KB)
Poured from bottle on 2020-03-13 at 01:34:15
[...]
~ ❯❯❯ brew info openexr
openexr: stable 2.4.1 (bottled)
High dynamic-range image file format
https://www.openexr.com/
/usr/local/Cellar/openexr/2.4.1 (151 files, 6.8MB) *
Poured from bottle on 2020-03-12 at 14:43:22
[...]
Hi @SebastianGrans! I'm having the exact problem as you do. Have you solved the problem yet? Any chance that you could offer some tips? Thank you!
@SarahChane98: I didn't solve it, but I discovered that OpenCV can import EXR files as well.
You can install it via pip
as the package opencv-python
.
import cv2
im = cv2.imread('path/file.exr')
Thank you so much! Just wondering, will Opencv output the same format as OpenEXR?
Somehow I ended up coming back to needing this package. I'm not exactly sure what's going on, but it has something to do with which C++ standard is used when compiling OpenEXR. Specifically we need to specify that C++11 should be used.
Installing OpenEXR on Linux works great but doesn't work on Mac. So it probably has something to do with Clang vs GCC. The solution is rather simple.
- Download the package:
pip download openexr
(This downloads e.g. OpenEXR-1.3.2.tar.gz) - Unpack the file:
tar -xzvf OpenEXR-1.3.2.tar.gz
- This creates a folder:
OpenEXR-1.3.2/
. Inside that folder issetup.py
which we need to modify. - Modify the line
extra_compile_args
so that it looks like this:extra_compile_args=['-g', '-DVERSION="%s"' % version, '-std=c++11'])
(Notice that we have added the flag for the C++11 standard). - While standing inside the folder, install the package by running
pip install .
I'm not sure if this would have any consequences on other platforms, but maybe @jamesbowman could look into it?