gcc cannot find file even though it is on the include path - python

I'm trying to install a local Python package on Scientific Linux 7.9, Python version 3.8. The package contains Cython so needs Python headers to build. This is installed and is on the include path, but gcc is still claiming it can't find it. Is this a permissions issue?
$ python setup.py install
running install
...
building 'farm.rasters.water_fill' extension
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 -I/opt/rh/rh-python38/root/usr/include -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 -I/opt/rh/rh-python38/root/usr/include
-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/home/jon/.jenkins/workspace/Farmmap_revision_linux_py36/TOXENV/py38/venv/lib64/python3.8/site-packages/numpy/core/include
-I/home/jon/.jenkins/workspace/Farmmap_revision_linux_py36/TOXENV/py38/venv/include
-I/opt/rh/rh-python38/root/include/python3.8 -c farm/rasters/water_fill.c
-o build/temp.linux-x86_64-3.8/farm/rasters/water_fill.o
farm/rasters/water_fill.c:19:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
I have installed rh-python38-python-devel, which includes the headers and they are in the -I path given above.
$ ls -l /opt/rh/rh-python38/root/usr/include/python3.8/
...
-rw-r--r--. 1 root root 3615 Jun 28 11:08 Python.h
Do I just need to chown this directory? I haven't needed to do this on other machines I have installed the package on.

I have figured it out - while the executables /usr/bin/python and /bin/python appear to be the same, only one of them has the associated header files.
When I create a venv using
$ /opt/rh/rh-python38/root/usr/bin/python3.8 -m venv venv
I can build my project, but when I create the venv with
$ /opt/rh/rh-python38/root/bin/python3.8 -m venv venv
I cannot.
When I try to look for the includes associated with the second executable, there is nothing there.
$ ls /opt/rh/rh-python38/root/include/python3.8
ls: cannot access /opt/rh/rh-python38/root/include/python3.8: No such file or directory

if it is not showing path and showing a you a "path not found" error.
Simply try to open windows PowerShell as administrator and type a command
sfc /scannow and wait for some minutes if it will show you that it found some files are corrupted or other corrupted warnings. then you simply run a command
Dism /Online /Cleanup-Image /RestoreHealth and wait for half an hour, it takes time and restart your PC and then check again if it is working or not.
Hope its Helps you 🙂.

Related

Error while installing pam-python-1.0.5

When i run make command i receive following error
rm -f html/index.html && ln -s pam_python.html html/index.html
make[1]: Leaving directory `/home/vagrant/pam-python-1.0.5/doc'
make --directory src
make[1]: Entering directory `/home/vagrant/pam-python-1.0.5/src'
gcc -O0 -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror -g -o ctest ctest.c -lpam
CFLAGS="-Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror" ./setup.py build
running build
running build_ext
building 'pam_python' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror -fPIC -DLIBPYTHON_SO="libpython2.6.so.1.0" -I/usr/include/python2.6 -c pam_python.c -o build/temp.linux-x86_64-2.6/pam_python.o
In file included from /usr/include/python2.6/pyconfig.h:6,
from /usr/include/python2.6/Python.h:8,
from pam_python.c:36:
/usr/include/python2.6/pyconfig-64.h:1043:1: error: "_XOPEN_SOURCE" redefined
In file included from /usr/include/stdlib.h:25,
from /usr/include/security/_pam_macros.h:12,
from pam_python.c:32:
/usr/include/features.h:164:1: error: this is the location of the previous definition
error: command 'gcc' failed with exit status 1
System which i am using is CentOs 6.7.
Is there any other way to directly install pam module for python so that it generated pam_python.so in lib64/security directory.
Suggest : Use the stable version = python-pam-1.8.2 .
The EL6 package : python-pam-1.8.2-2.el6.noarch.rpm ( 9.7kB ) https://drive.google.com/file/d/0B7S255p3kFXNQ1FrM1poTXR5Nmc/view?usp=sharing
Download the package, and ...
cd Downloads/
# yum install python-pam-1.8.2-2.el6.noarch.rpm
EDIT : About the other "module" = pam-python 1.0.5 : Seems I found a solution →
cd pam-python-1.0.5/src/
python setup.py build
... and the file build/lib.linux-x86_64-2.6/pam-python.so was created.
Install : # python setup.py install ... the install text shows what's installed ... pam_python.py, pam_python.pyc,
/usr/lib64/python2.6/site-packages/pam_python-1.0.5-py2.6-linux-x86_64.egg/pam_python.so

gcc cannot find cc1plus

I'm trying to install the python package pandas on CentOS 6 but I'm having problems with the gcc compiler:
sudo pip install pandas
...
creating build/temp.linux-x86_64-2.7/pandas/msgpack
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D__LITTLE_ENDIAN__=1 -Ipandas/src/msgpack -Ipandas/src/klib -Ipandas/src -I/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include -I/opt/rh/python27/root/usr/include/python2.7 -c pandas/msgpack/_packer.cpp -o build/temp.linux-x86_64-2.7/pandas/msgpack/_packer.o -Wno-unused-function
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
...
So it appears I need cc1plus, which by reading around requires gcc-g++. But I already have gcc-c++:
sudo yum install gcc-c++
...
Package gcc-c++-4.4.7-16.el6.x86_64 already installed and latest version
Nothing to do
About gcc and cc1plus:
gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
which gcc
/opt/rh/devtoolset-2/root/usr/bin/gcc
locate cc1plus
/usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1plus
My own solution below. Does anybody have better ways of addressing the problem?
Solution to my own question:
It seems that cc1plus, although present, is not visible to gcc as it is not on path. So a solution is to link cc1plus to a directory on PATH:
sudo ln -s /usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1plus /usr/local/bin/
Now sudo pip install pandas succeeds.
(But why the package manager put cc1plus there in the first place?)

anyone has install scipy on aws free tier?

I've got problem when pip install scipy on aws micro instance, which has only 512 MB memory.
lapack-devel, blas-devel, and numpy already installed.
some one said the memory is too small to build c++ when install scipy.
if anyone succeeded or has similar binary scipy install image, please lend a hand.
image:
Linux ip-172-31-16-186 3.4.43-43.43.amzn1.x86_64 #1 SMP Mon May 6 18:04:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
last building log:
scipy/sparse/sparsetools/csr_wrap.cxx: In function ‘void init_csr()’:
scipy/sparse/sparsetools/csr_wrap.cxx:73303:21: warning: variable ‘md’ set but not used [-
Wunused-but-set-variable]
{standard input}: Assembler messages:
{standard input}:115706: Warning: end of file not at end of a line; newline inserted
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
error: Command "g++ -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 - fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer- size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D__STDC_FORMAT_MACROS=1 -I/home/ec2-user/ env/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c scipy/sparse/sparsetools/ csr_wrap.cxx -o build/temp.linux-x86_64-2.7/scipy/sparse/sparsetools/csr_wrap.o" failed with exit status 4

Error when installing pyodbc-3.0.6 on Fedora

I am trying to install pyodbc-3.0.6 on Fedora.
I had downloaded it from here
When I run it with python setup.py install it's displaying the following error
running install
running bdist_egg
running egg_info
writing pyodbc.egg-info/PKG-INFO
writing top-level names to pyodbc.egg-info/top_level.txt
writing dependency_links to pyodbc.egg-info/dependency_links.txt
writing pyodbc.egg-info/PKG-INFO
writing top-level names to pyodbc.egg-info/top_level.txt
writing dependency_links to pyodbc.egg-info/dependency_links.txt
reading manifest file 'pyodbc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'tests/*'
writing manifest file 'pyodbc.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/home
creating build/temp.linux-x86_64-2.7/home/local
creating build/temp.linux-x86_64-2.7/home/local/PENNYWISE
creating build/temp.linux-x86_64-2.7/home/local/PENNYWISE/shivakrishnab
creating build/temp.linux-x86_64-2.7/home/local/PENNYWISE/shivakrishnab/Desktop
creating build/temp.linux-x86_64-2.7/home/local/PENNYWISE/shivakrishnab/Desktop/pyodbc-3.0.6
creating build/temp.linux-x86_64-2.7/home/local/PENNYWISE/shivakrishnab/Desktop/pyodbc-3.0.6/src
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=3.0.6 -I/usr/include/python2.7 -c /home/local/user/Desktop/pyodbc-3.0.6/src/buffer.cpp -o build/temp.linux-x86_64-2.7/home/local/user/Desktop/pyodbc-3.0.6/src/buffer.o -Wno-write-strings
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
Can anyone let me know how to solve this.
Edited Code:
After installing g++ as indicated by below command and when I run the following command
python setup.py install
from inside the pyodbc downloaded folder I got the following error
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'pyodbc' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=3.0.6 -I/usr/include/python2.7 -c /home/local/user/Desktop/pyodbc-3.0.6/src/buffer.cpp -o build/temp.linux-x86_64-2.7/home/local/user/Desktop/pyodbc-3.0.6/src/buffer.o -Wno-write-strings
In file included from /home/local/user/Desktop/pyodbc-3.0.6/src/buffer.cpp:12:0:
/home/local/user/Desktop/pyodbc-3.0.6/src/pyodbc.h:48:17: fatal error: sql.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
You need to install g++ package. yum install compat-gcc-34-c++
(edit: it seems they moved it to compat-gcc-34-c++)
[edit]
For the second issue - you are missing unixODBC-devel package.
For CentOS the package name is gcc-c++
To suppress the exception:
sql.h: No file or directory in CentOS install unixODBC-devel.x86_64
Run the following command for 64-bit:
yum install unixODBC-devel.x86_64

Python: mysqldb install error

So i've been pulling my hair out trying to install the mysqldb package.
When i run the build i get a long transcript of errors, heres just part of it, i would posit it all but its huge list of errors
[rv#med240-183 MySQL-python-1.2.3c1]$ sudo python setup.py build
[sudo] password for rv:
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
Any ideas?
yum install mysql-devel

Categories

Resources