How can I solve openexr install error in Ubuntu?

851 Views Asked by At

I'm try to install openexr in ubuntu with pip install openexr. But it's not work. Also I tried to install with .whl file, but error is returned.

ERROR: OpenEXR-1.3.7-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.

How can I solve this problem?

Python : 3.9.5

Ubuntu : 21.04

pip : 22.0.4

Error log:

Collecting openexr
  Using cached OpenEXR-1.3.7.tar.gz (11 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: openexr
  Building wheel for openexr (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Looking for libOpenEXR...
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      copying Imath.py -> build/lib.linux-x86_64-3.9
      running build_ext
      building 'OpenEXR' extension
      creating build/temp.linux-x86_64-3.9
      clang-9 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -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/home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/include -I/usr/include/python3.9 -c OpenEXR.cpp -o build/temp.linux-x86_64-3.9/OpenEXR.o -g -DVERSION=\"1.3.7\"
      clang: error: unknown argument: '-ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=.'
      error: command '/usr/bin/clang-9' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error
  
  × Running setup.py install for openexr did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Looking for libOpenEXR...
      running install
      /home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      copying Imath.py -> build/lib.linux-x86_64-3.9
      running build_ext
      building 'OpenEXR' extension
      creating build/temp.linux-x86_64-3.9
      clang-9 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -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/home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/include -I/usr/include/python3.9 -c OpenEXR.cpp -o build/temp.linux-x86_64-3.9/OpenEXR.o -g -DVERSION=\"1.3.7\"
      clang: error: unknown argument: '-ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=.'
      error: command '/usr/bin/clang-9' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> openexr

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
1

There are 1 best solutions below

0
On

The option ffile-prefix-map which is used in the compilation here is only available in clang starting with version 10, see here. You seem to have clang-9, so simply get a newer version:

sudo apt install clang-11

Additional Note: Your whl is for windows, as marked by the tag win_amd64 whcih is why it won't install to your ubuntu system