I tried to install mysql module with pip install mysql-python and I got this:
(env)nathann#esp2:/home/esp2$ sudo pip install mysql-python
Downloading/unpacking mysql-python
Downloading MySQL-python-1.2.5.zip (108Kb): 108Kb downloaded
Running setup.py egg_info for package mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
_mysql.c:29:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/esp2/build/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-yuSaAG-record/install-record.txt:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
_mysql.c:29:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/esp2/build/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-yuSaAG-record/install-record.txt failed with error code 1
Storing complete log in /home/nathann/.pip/pip.log
(env)nathann#esp2:/home/esp2$
You probably do not have the python development headers installed. On debian flavors:
sudo apt-get install python-dev
On other unix flavors, sometimes it's called python-devel
Related
this is the error i'm getting:
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(2,0,0,'dev',1) -D__version__=2.0.0dev1 -I/usr/include/mysql -I/usr/include/python3.7m -I/deployment/portfolio/venv/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /deployment/portfolio/venv/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vbpwzo_w/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vbpwzo_w/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-i8oey5_m/install-record.txt --single-version-externally-managed --compile --install-headers /deployment/portfolio/venv/include/site/python3.7/mysqlclient
cwd: /tmp/pip-req-build-vbpwzo_w/
Complete output (29 lines):
/deployment/portfolio/venv/lib/python3.7/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '2.0.0dev1' to '2.0.0.dev1'
normalized_version,
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/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(2,0,0,'dev',1) -D__version__=2.0.0dev1 -I/usr/include/mysql -I/usr/include/python3.7m -I/deployment/portfolio/venv/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /deployment/portfolio/venv/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vbpwzo_w/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vbpwzo_w/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-i8oey5_m/install-record.txt --single-version-externally-managed --compile --install-headers /deployment/portfolio/venv/include/site/python3.7/mysqlclient Check the logs for full command output.
i have seen so many questions, and installed so many things as:
python3.7-dev
python3-dev
python-dev
pip install mysqlclient==1.4.2.post1
pip install mysqlclient
sudo apt-get install python3.7-dev default-libmysqlclient-dev
apt-get install python3.7-dev libmysqlclient-dev
sudo apt-get install libssl-dev
pip install mysql-connector-python
nothing seem to work for me, and i don't know what to do anymore, any help is appreciated.
Problem Solved thanks to Nigel Savage, as he suggested i'll list what i did:
Ubuntu version 18.04.03 LTS
VPS: Google cloud instance
python 3.7.5 using virtualenv
apt-get install python3.7-dev
apt-get install python3.7-dev libmysqlclient-dev
apt install build-essential
pip install mysqlclient==1.4.2.post1
In my mac OSX i'm trying to use python2.7 and mariadb.
I am using pip install mysql-python or pip install mysqlclient as a connector. But system always give me bunch of error. Any other way to overcome this issues?
ERROR: Command errored out with exit status 1:
command: /Users/eskimi/Development/ErpNext/frappe-bench/env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/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 /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-wheel-MTABvV --python-tag cp27
cwd: /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/
Complete output (41 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.4.6_1/include/mysql -I/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/.. -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/my_config.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
^
In file included from _mysql.c:46:
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql.h:441:3: warning: this function declaration is not a prototype [-Wstrict-prototypes]
MYSQL_CLIENT_PLUGIN_HEADER
^
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql.h:437:16: note: expanded from macro 'MYSQL_CLIENT_PLUGIN_HEADER'
int (*deinit)(); \
^
_mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
~~~~~~~~~~~~~~~~ ^
2 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysql-python
ERROR: Command errored out with exit status 1:
command: /Users/eskimi/Development/ErpNext/frappe-bench/env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-record-PZ6DCs/install-record.txt --single-version-externally-managed --compile --install-headers /Users/eskimi/Development/ErpNext/frappe-bench/env/include/site/python2.7/mysql-python
cwd: /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/
Complete output (41 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.4.6_1/include/mysql -I/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/.. -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/my_config.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
^
In file included from _mysql.c:46:
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql.h:441:3: warning: this function declaration is not a prototype [-Wstrict-prototypes]
MYSQL_CLIENT_PLUGIN_HEADER
^
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql.h:437:16: note: expanded from macro 'MYSQL_CLIENT_PLUGIN_HEADER'
int (*deinit)(); \
^
_mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
~~~~~~~~~~~~~~~~ ^
2 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/eskimi/Development/ErpNext/frappe-bench/env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-install-gccSRs/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/1r/0z4_dp3j0237vqx1jvc0sn3c0000gp/T/pip-record-PZ6DCs/install-record.txt --single-version-externally-managed --compile --install-headers /Users/eskimi/Development/ErpNext/frappe-bench/env/include/site/python2.7/mysql-python Check the logs for full command output.
Traceback (most recent call last):
This is a good example why people shouldn't access internal/undocumented members of a structure instead of using a API function.
MariaDB's client library doesn't have a reconnect option in the MYSQL structure, according to the documentation for MySQL and MariaDB the reconnect option should be set via mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
However, this issue is already fixed in MySQLDB so you should download latest source and build the module locally (assuming that Python 2.7 modules won't be updated any more)
Forgive me if I ask something really simple
I am setting up a Django app on a remote server, by Namecheap (no root access)
and my server information:
Apache Version: 2.4.38
MySQL Version: 10.1.38-MariaDB-cll-lve
Architecture: x86_64
Operating System: linux
Python: 3.7
Django: 2.1.7
Now I'm trying to had mysql DB connect to my django app.
But when I try installing connector mysqlclient with pip install mysqlclient
I had this error:
$ pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/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/tmp45bylejwpip-wheel- --python-tag cp37:
/opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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 -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/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-v39up5s1-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/letsilap/virtualenv/IOT/3.7/include/site/python3.7/mysqlclient:
/opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
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/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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 -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
Command "/home/letsilap/virtualenv/IOT/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_19o3wdf/mysqlclient/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-v39up5s1-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/letsilap/virtualenv/IOT/3.7/include/site/python3.7/mysqlclient" failed with error code 1 in /tmp/pip-build-_19o3wdf/mysqlclient/
I dive into an error message,(understand)
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
it seem to show that error lies on permission of luinx system
Does anyone know how to solve this issue? highly, apprenticed
unable to execute 'gcc': Permission denied
means your user does not have permission to run the gcc C compiler.
This is pretty unusual, and it sounds like a (slightly ham-fisted) security measure on the server you're using. You will need to ask whoever administers the server for assistance.
you must have root permission to run these type of commands usually. add sudo to your command:
sudo pip install mysqlclient
I have a project which has a dependency on MySQL-python==1.2.5
I have checked out answers like this, this and this. However none of the steps mentioned in all those answers helped.
So this project is a Django application with a dependency on MySQL-python as mentioned above. The project is in Python 2.7 and cannot be upgraded to Python 3.X.
When I run,
pip install MySQL-python
I get the below as the error:
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/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 /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-wheel-e63D7H --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command /Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/Users/user.m2/.virtualenvs/del/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-record-gOGq_n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user.m2/.virtualenvs/del/include/site/python2.7/MySQL-python" failed with error code 1 in /private/var/folders/f3/t5bk652s70g8f7x3q6_q290drg8nf8/T/pip-install-YiTuKO/MySQL-python/
I have tried using a different virtual env, tried updating homebrew before doing the above steps. I still cant get this to install.
Is there any way to get this working?
This procedure worked for me:
brew remove mysql
brew install mysql#5.7
brew link --force mysql#5.7
pip install mysql-python
I read a post and adjusted the procedure to link things in the /usr/local/bin instead of adding a new route to the PATH variable.
Reference: MacOS: "pip install MySQL-python" returning an error: "_mysql.c:44:10: fatal error: 'my_config.h' file not found"
I am on Ubuntu 16:
$ pip -V
pip 18.0 from /home/XYZ-ubuntu/.local/lib/python3.6/site-packages/pip (python 3.6)
XYZ-ubuntu#XYZubuntu-desktop:~/Desktop/MCF/BitMEX-simple-trading-robot-master$ pip3 -V
pip 18.0 from /home/usm-ubuntu/.local/lib/python3.6/site-packages/pip (python 3.6)
When I run this:
pip install TA-lib
I receive the following error:
$ pip install TA-lib
Collecting TA-lib
Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Requirement already satisfied: numpy in /home/usm-ubuntu/.local/lib/python3.6/site-packages (from TA-lib) (1.15.1)
Building wheels for collected packages: TA-lib
Running setup.py bdist_wheel for TA-lib ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/TA-lib/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-3i94vijy --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/usm-ubuntu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for TA-lib
Running setup.py clean for TA-lib
Failed to build TA-lib
Installing collected packages: TA-lib
Running setup.py install for TA-lib ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/TA-lib/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-bsagqzqb/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/usm-ubuntu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/TA-lib/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-bsagqzqb/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-72o18u12/TA-lib/
I've followed everything here -
Unable to install TA-Lib on Ubuntu
I've spent hours on this and googling it to no avail. Does anyone have a solution? Thanks
I solved this issue by upgrading to Ubuntu 18.04 LTS. I had conflicts between Python 2.7 and 3.5/3.6.
After upgrading I changed the alias to python3 using nano ~/.bashrc and adding line alias python = python3.
Then installed TA-lib by running command:
python3 -m pip install TA-lib
Now everything is working fine. Thanks