jamesbowman / openexrpython

OpenEXR bindings for Python
Other
94 stars 35 forks source link

pip install error: Cannot open include file: 'ImathBox.h' #11

Open jamietelford opened 7 years ago

jamietelford commented 7 years ago

Hi James,

I have built OpenEXR etc using the script provided at https://github.com/vfxpro99/usd-build-club

However I can't link the ImathBox.h which has been built to C:\EXR\OPENEXR

any tips would be awesome..

thanks bro!

jamesbowman commented 7 years ago

Puzzling... did you know that there are pre-built Windows libraries here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

On Wed, Jun 28, 2017 at 1:06 PM, Jamie Telford notifications@github.com wrote:

Hi James,

I have built OpenEXR etc using the script provided at https://github.com/vfxpro99/usd-build-club

However I can't link the ImathBox.h which has been built to C:\EXR\OPENEXR

any tips would be awesome..

thanks bro!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jamesbowman/openexrpython/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2nKyp9KzW5feCH_jrv2M_nqKNT8fydks5sId9dgaJpZM4OHfsl .

-- James Bowman http://www.excamera.com/

jamietelford commented 7 years ago

oh.. I did not know about the prebuilt binaries.. thx!

I did manage to include ImathBox.h but got another error

OpenEXR.cpp(1233): error C2059: syntax error: 'constant' error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

anyway.. I'll have a go with the prebuilt binaries..

tuket commented 6 years ago

I had the same problem installing from pip. I will try those prebuilt binaries.

nedwilson commented 6 years ago

This issue exists on macOS High Sierra, but I solved it with the following (requires homebrew):

uathena1991 commented 6 years ago

@nedwilson it works. openexr installed successfully. But when I tried to import openexr, a new error occured:

ImportError: dlopen(/anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so, 2): Symbol not found: __ZN7Imf_2_214TypedAttributeISsE13readValueFromERNS_7IStreamEii Referenced from: /anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so Expected in: flat namespace in /anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so

jingya-hello commented 5 years ago

@uathena1991 Using other python version(3.5 or 2)will be be fine.

jbartolozzi commented 5 years ago

@nedwilson it works. openexr installed successfully. But when I tried to import openexr, a new error occured:

ImportError: dlopen(/anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so, 2): Symbol not found: __ZN7Imf_2_214TypedAttributeISsE13readValueFromERNS_7IStreamEii Referenced from: /anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so Expected in: flat namespace in /anaconda/envs/tf1/lib/python2.7/site-packages/OpenEXR.so

I am having the same issue trying to install on OSX 10.13.6 I have tried building openexr from source and building these bindings from source.

Please look at https://github.com/openexr/openexr/issues/207#issuecomment-459156456

I'm not sure why this is happening and it's now prevented me from doing a good amount of work. any ideas @jamesbowman? any insights would be greatly appreciated

jbartolozzi commented 5 years ago

Here's an example of how I've modified the setup.py to account for my miniconda installation. setup.txt

The build is successful and when i run otool -L build/lib.macosx-10.6-x86_64-2.7/OpenEXR.so I get @rpath/libIex-2_3.24.dylib (compatibility version 24.0.0, current version 2.3.0) @rpath/libHalf-2_3.24.dylib (compatibility version 24.0.0, current version 2.3.0) @rpath/libImath-2_3.24.dylib (compatibility version 24.0.0, current version 2.3.0) @rpath/libIlmImf-2_3.24.dylib (compatibility version 24.0.0, current version 2.3.0) @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

but still python -c "import OpenEXR" gives me: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: dlopen(/Users/jbartolozzi/miniconda2/lib/python2.7/site-packages/OpenEXR.so, 2): Symbol not found: __ZN7Imf_2_314TypedAttributeISsE13readValueFromERNS_7IStreamEii Referenced from: /Users/jbartolozzi/miniconda2/lib/python2.7/site-packages/OpenEXR.so Expected in: flat namespace in /Users/jbartolozzi/miniconda2/lib/python2.7/site-packages/OpenEXR.so

jbartolozzi commented 5 years ago

I have solved the problem above by modifying the setup.py to the following: setup.txt

Edit Confirming that this works on OSX 10.13.6 with the openexr 2.3.0 libs from conda install -c conda-forge openexr

zkailinzhang commented 5 years ago

@jamietelford my pc is ubuntu 16 64bit,pip install openexr error, try your method, conda install -c conda-forge openexr it is well installed but when in pythonfile, import OpenEXR,, error log import OpenEXR ModuleNotFoundError: No module named 'OpenEXR'

ittim4 commented 5 years ago

@zkl99999 : Were you able to fix above 'ModuleNotFoundError' ? I ran into the exact same issue after successful installation by 'conda install -c conda-forge openexr'. [Edit- Ans]: Realized that above method installs c++ based version & doesn't have python binding, and hence cant be imported in python environment. @jamietelford and @jamesbowman : Q1) Can you elaborate steps to install prebuilt windows library from http://www.lfd.uci.edu/~gohlke/pythonlibs/ ? [Edit - Ans]: OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl worked on my system (win8, 64b, python 3.7). Now, 'import OpenEXR' works in python :)! Thanks all!

jpaugh commented 4 years ago

For Ubuntu (and Debian?) it can be solved with sudo apt install libopenexr-dev, so that you pull in the header that gcc is complaining about in the pip build.

ckxz commented 3 years ago

Hi @ittim4, I'm facing the exact same issue you did. Could you please elaborate the steps you followed to insall the prebuilt windows library from http://www.lfd.uci.edu/~gohlke/pythonlibs/? Thanks!

Edit: Figured it out. To anyone interested, 1. download prebuilt library (e.g. OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#openexr), 2. access directory where .whl file has been downloaded from command line, 3. run pip install OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl. Discussed in detail here.

@zkl99999 : Were you able to fix above 'ModuleNotFoundError' ? I ran into the exact same issue after successful installation by 'conda install -c conda-forge openexr'. [Edit- Ans]: Realized that above method installs c++ based version & doesn't have python binding, and hence cant be imported in python environment. @jamietelford and @jamesbowman : Q1) Can you elaborate steps to install prebuilt windows library from http://www.lfd.uci.edu/~gohlke/pythonlibs/ ? [Edit - Ans]: OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl worked on my system (win8, 64b, python 3.7). Now, 'import OpenEXR' works in python :)! Thanks all!

RecursiveAV commented 3 years ago

i used the method by @ckxz mention above and it worked great - Thanks!!

Edit: Figured it out. To anyone interested, 1. download prebuilt library (e.g. OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#openexr), 2. access directory where .whl file has been downloaded from command line, 3. run pip install OpenEXR‑1.3.2‑cp37‑cp37m‑win_amd64.whl. Discussed in detail here.