Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenEXR.cpp:1:10: fatal error: Python.h: No such file or directory in Ubuntu 18.04 and Blender Bundled Python 3.5m #1598

Open
monajalal opened this issue Dec 19, 2023 · 0 comments

Comments

@monajalal
Copy link

monajalal commented Dec 19, 2023

[Disclaimer] I need to use the same exact version of Blender (2.79a) and the bundled Python (3.5m) that comes with it.
Steps to reproduce the problem:


root@fae597dbdb79:/home/pvnet-rendering# /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m run.py --type rendering
/home/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/__init__.py
Traceback (most recent call last):
  File "run.py", line 24, in <module>
    globals()['run_' + args.type]()
  File "run.py", line 11, in run_rendering
    from blender.render_utils import Renderer, YCBRenderer
  File "/home/pvnet-rendering/blender/render_utils.py", line 9, in <module>
    import OpenEXR
ImportError: No module named 'OpenEXR'


root@fae597dbdb79:/home/pvnet-rendering# /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/pip3 install OpenEXR
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting OpenEXR
  Using cached OpenEXR-1.3.9.tar.gz (13 kB)
Building wheels for collected packages: OpenEXR
  Building wheel for OpenEXR (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/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 /tmp/pip-wheel-mduho4ah
       cwd: /tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/
  Complete output (17 lines):
  Looking for libOpenEXR...
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  copying Imath.py -> build/lib.linux-x86_64-3.5
  running build_ext
  building 'OpenEXR' extension
  creating build/temp.linux-x86_64-3.5
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -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/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c OpenEXR.cpp -o build/temp.linux-x86_64-3.5/OpenEXR.o -g -DVERSION="1.3.9"
  cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
  OpenEXR.cpp:1:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: command 'gcc' 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: /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-u2_7y4fa/install-record.txt --single-version-externally-managed --compile --install-headers /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m/OpenEXR
         cwd: /tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/
    Complete output (17 lines):
    Looking for libOpenEXR...
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    copying Imath.py -> build/lib.linux-x86_64-3.5
    running build_ext
    building 'OpenEXR' extension
    creating build/temp.linux-x86_64-3.5
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -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/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c OpenEXR.cpp -o build/temp.linux-x86_64-3.5/OpenEXR.o -g -DVERSION="1.3.9"
    cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    OpenEXR.cpp:1:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ff4ixufr/openexr_e96f1121b9af49e8ba0e6828abe51305/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-u2_7y4fa/install-record.txt --single-version-externally-managed --compile --install-headers /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m/OpenEXR Check the logs for full command output.

Related links:

https://stackoverflow.com/questions/77686055/lmdb-cpython-c2610-fatal-error-python-h-no-such-file-or-directory

#1581 (comment)

If I try to build the package from git repo,

root@fae597dbdb79:/home# git clone https://github.com/sanguinariojoe/pip-openexr
Cloning into 'pip-openexr'...
remote: Enumerating objects: 242, done.
remote: Counting objects: 100% (75/75), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 242 (delta 35), reused 63 (delta 30), pack-reused 167
Receiving objects: 100% (242/242), 58.42 KiB | 1013.00 KiB/s, done.
Resolving deltas: 100% (115/115), done. 
root@fae597dbdb79:/home# cd pip-openexr/
root@fae597dbdb79:/home/pip-openexr# /home/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m setup.py install       
  File "setup.py", line 8
    VERSION = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_PATCH}"
                                                               ^
SyntaxError: invalid syntax

Tasks

No tasks being tracked yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant