rfoo icon indicating copy to clipboard operation
rfoo copied to clipboard

Error During Installation - Python.h: No such file or directory

Open sohang3112 opened this issue 2 years ago • 1 comments

Steps Followed:

  • Clone this repository and cd to it.
  • Output of python setup.py install:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/rfoo
copying rfoo/__init__.py -> build/lib.linux-x86_64-3.7/rfoo
copying rfoo/_rfoo.py -> build/lib.linux-x86_64-3.7/rfoo
creating build/lib.linux-x86_64-3.7/rfoo/utils
copying rfoo/utils/__init__.py -> build/lib.linux-x86_64-3.7/rfoo/utils
copying rfoo/utils/rconsole.py -> build/lib.linux-x86_64-3.7/rfoo/utils
running build_ext
cythoning rfoo/marsh.pyx to rfoo/marsh.c
/home/sohang.chopra/.local/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/sohang.chopra/rfoo/rfoo/marsh.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
building 'rfoo.marsh' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/rfoo
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -c rfoo/marsh.c -o build/temp.linux-x86_64-3.7/rfoo/marsh.o
rfoo/marsh.c:6:10: fatal error: Python.h: No such file or directory
 #include "Python.h"
          ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

Note: README.md said to do sudo python setup.py install but I did this without sudo as I don't have sudo access to the system.

Environment

$ python --version
Python 3.7.10
$ cython --version
Cython version 0.29.33
$ uname -r
4.14.246-187.474.amzn2.x86_64

sohang3112 avatar Jan 17 '23 07:01 sohang3112

This issue can be fixed by installing system package python3-devel, but I don't know any way to do that without sudo access.

sohang3112 avatar Feb 22 '23 01:02 sohang3112

@aaiyer Maybe the error message of setup.py install can mention that the system package python3-devel needs to be installed first.

sohang3112 avatar Apr 20 '24 01:04 sohang3112