virtualenv gcc error - python

IF I use --no-site-packages option while creating a virtualenv and try to install MySQL-python afterwards I get :
error: command 'gcc' failed with exit status 1
Here are the steps I followed:
easy_install-2.7 --install-dir ~/src/lib/ virtualenv==dev
~/src/lib/virtualenv --no-site-packages ENV
.../ENV/bin/pip-2.7 install MySQL-python
I also tried downloading mySQL-python and install using
.../ENV/bin/python setup.py build
I get the same error wither way.
I assume I am missing the gcc from this virtualenv but how do I get it installed in this virtualenv while still using --no-site-packages option.
thanks
EDIT: as per below comments here is the whole error output.
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -m32 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/lampp/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv
In file included from /opt/lampp/include/python2.7/Python.h:58,
from pymemcompat.h:10,
from _mysql.c:29:
/opt/lampp/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from /usr/include/mysql/my_config.h:11,
from _mysql.c:36:
/usr/include/mysql/my_config_x86_64.h:1032:1: warning: "SIZEOF_LONG" redefined
In file included from /opt/lampp/include/python2.7/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/opt/lampp/include/python2.7/pyconfig.h:989:1: warning: this is the location of the previous definition
error: command 'gcc' failed with exit status 1

you need the mysql-devel package. to install, you need to specify the actual package name -
sudo apt-get install libmysql++-dev

Have you tried using the sudo command. I am guessing you are having permission issues than issue with anything else here. Usually an install throws up this error as it is trying to access directories with root permission which you don't own.

Related

Error when installing pyminizip on docker

I am getting an error while installing pyminizip package inside docker container ( docker version 17.03.1-ce). I am doing it inside virtual environment with python 2.7.13.
I ended up with below message while trying to install it.
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isrc -Izlib123 -I/usr/local/include/python2.7 -c src/py_minizip.c -o build/temp.linux-x86_64-2.7/src/py_minizip.o
src/py_minizip.c: In function ‘_compress’:
src/py_minizip.c:251: warning: ‘filepathnameinzip’ may be used uninitialized in this function
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isrc -Izlib123 -I/usr/local/include/python2.7 -c src/zip.c -o build/temp.linux-x86_64-2.7/src/zip.o
In file included from src/zip.c:66:
src/crypt.h:34: error: redefinition of typedef ‘z_crc_t’
src/zip.h:83: note: previous declaration of ‘z_crc_t’ was here
src/zip.c:201: warning: function declaration isn’t a prototype
src/zip.c:203: warning: function declaration isn’t a prototype
error: command 'gcc' failed with exit status 1
Is there any alternate of pyminizip package ?
I want to create a password protected zip. So, even if there is any alternate solution to it, please let me know.
Would be useful know what docker image you use... but Try to Install python developer version:
sudo apt-get install python-dev
and libevent libraries
sudo apt-get install libevent-dev
This issue has been resolved. It is working fine with pyminizip version 0.2.1. I had faced this issue on 0.2.2 and
0.2.3 but version 0.2.1 is working fine for me.

gcc compiler not recognizing -fno-plt option

I am trying to compile QuantLib Python SWIG bindings on Amazon's EC2 instance with Amazon Linux AMI. I have managed to compile QuantLib itself successfully, however, when trying to compile anaconda python swig bindings, I am getting an error with -fno-plt option. I have upgraded the gcc compiler version to 5.4.0, originally it was 4.8
First I configure as below:
sudo ./configure --disable-perl --disable-ruby --disable-mzscheme --disable-guile --disable-csharp --disable-ocaml --disable-r --disable-java PYTHON=/opt/anaconda/anaconda2/bin/python
Then I make as below:
make -C Python
I get the error :
make: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
make all-am
make[1]: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
CXXFLAGS="-O3 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" CC="gcc" CXX="g++" /opt/anaconda/anaconda2/bin/python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
gcc -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/anaconda/anaconda2/include/python2.7 -I/usr/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.linux-x86_64-2.7/QuantLib/quantlib_wrap.o -Wno-unused -O3 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings
gcc: error: unrecognized command line option ‘-fno-plt’
error: command 'gcc' failed with exit status 1
make[1]: *** [.build-stamp] Error 1
make[1]: Leaving directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
make: *** [all] Error 2
make: Leaving directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
I am very new to this and do not know if I can remove -fno-plt option when compiling and if yes, how?
You need to upgrade your GCC version.
The changelog page for GCC 6 says:
The option -fno-plt is now fully functional.
Thus, from GCC 6 you can use it.

Error installing Pygame on Ubuntu

So I've been following some instructions on how to install Pygame from this link here :http://programarcadegames.com/index.php?showpart=0#section_0.3
The the final three commands are as follows
$
# Use mercurial to clone current code
hg clone https://bitbucket.org/pygame/pygame
# Build and install
cd pygame
sudo python3 setup.py
$
When I run the final command to run the setup file, I get this error after everything before it runs fine.
building 'pygame.imageext' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python2.7 -c src/imageext.c -o build/temp.linux-x86_64-2.7/src/imageext.o
In file included from src/pygame.h:32:0,
from src/imageext.c:49:
src/_pygame.h:80:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Any ideas as to how I cann fix this issue and complete my Pygame installation?
You need to install the python development package, which includes those header files.
sudo apt-get install python-dev

aspell-python installation error

I am trying to install aspell-python package for spell correction.
Facing problem while installing the package.
Error :
python setup.py install
running install
running build
running build_ext
building 'aspell' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c aspell.c -o build/temp.linux-i686-2.7/aspell.o
aspell.c:53:20: fatal error: aspell.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
GCC is already install version gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
libaspell15 is already install
Need to install sudo apt-get install libaspell-dev

error: command 'gcc' failed with exit status 1-centos

I am trying to install Mysql-python connector for mysql.I am facing this error"error: command 'gcc' failed with exit status 1"
I tried with installation of
1.gcc using yum install gcc
2.python-devel and mysql-devel using yum install python-devel mysql-devel
Nothing solved my problem.
Please see my traceback:
[root#localhost MySQL-python-1.2.4b4]# python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/local/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_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
_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
_mysql.c:602: error: expected expression before ‘)’ token
error: command 'gcc' failed with exit status 1
Need help.

Categories