This question already has answers here:
setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 [closed]
(38 answers)
Closed 4 years ago.
So i am trying to install zipline, and i am getting an error i don't know how to handle. Firstly i run the following commands:
virtualenv -p python3.5 zipline
source /zipline/bin/activate
Then as the guide suggests
sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev
this installs with out a hitch, then
pip install numpy
pip install cython
pip install -U setuptools
then lastly
pip install zipline
This gives med the following (long) error message, even though i looks like it is the same error multiple times.
zipline/assets/_assets.c:4:10: 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
----------------------------------------
Failed building wheel for zipline
Running setup.py clean for zipline
Running setup.py bdist_wheel for cyordereddict ... error
Complete output from command /home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/cyordereddict/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-dsh6t2sb --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/cyordereddict
copying python3/cyordereddict/_version.py -> build/lib.linux-x86_64-3.5/cyordereddict
copying python3/cyordereddict/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict
creating build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/magic_timeit.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/benchmark.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
creating build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/test_ordereddict.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/test_cyordereddict.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/_mapping_tests.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
running build_ext
building 'cyordereddict._cyordereddict' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/python3
creating build/temp.linux-x86_64-3.5/python3/cyordereddict
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-FZMKe6/python3.5-3.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -I/home/bluehelmet/virtualenv/zipline/include/python3.5m -c python3/cyordereddict/_cyordereddict.c -o build/temp.linux-x86_64-3.5/python3/cyordereddict/_cyordereddict.o
python3/cyordereddict/_cyordereddict.c:12:10: 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
----------------------------------------
Failed building wheel for cyordereddict
Running setup.py clean for cyordereddict
Running setup.py bdist_wheel for bottleneck ... error
Complete output from command /home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/bottleneck/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-_x73ag17 --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/bottleneck
copying bottleneck/version.py -> build/lib.linux-x86_64-3.5/bottleneck
copying bottleneck/__init__.py -> build/lib.linux-x86_64-3.5/bottleneck
creating build/lib.linux-x86_64-3.5/bottleneck/slow
copying bottleneck/slow/nonreduce.py -> build/lib.linux-x86_64-3.5/bottleneck/slow
copying bottleneck/slow/reduce.py -> build/lib.linux-x86_64-3.5/bottleneck/slow
copying bottleneck/slow/move.py -> build/lib.linux-x86_64-3.5/bottleneck/slow
copying bottleneck/slow/__init__.py -> build/lib.linux-x86_64-3.5/bottleneck/slow
copying bottleneck/slow/nonreduce_axis.py -> build/lib.linux-x86_64-3.5/bottleneck/slow
creating build/lib.linux-x86_64-3.5/bottleneck/src
copying bottleneck/src/template.py -> build/lib.linux-x86_64-3.5/bottleneck/src
copying bottleneck/src/__init__.py -> build/lib.linux-x86_64-3.5/bottleneck/src
creating build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/nonreduce_axis_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/scalar_input_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/reduce_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/list_input_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/nonreduce_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/move_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/__init__.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/input_modifcation_test.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
copying bottleneck/tests/util.py -> build/lib.linux-x86_64-3.5/bottleneck/tests
creating build/lib.linux-x86_64-3.5/bottleneck/benchmark
copying bottleneck/benchmark/autotimeit.py -> build/lib.linux-x86_64-3.5/bottleneck/benchmark
copying bottleneck/benchmark/bench_detailed.py -> build/lib.linux-x86_64-3.5/bottleneck/benchmark
copying bottleneck/benchmark/bench.py -> build/lib.linux-x86_64-3.5/bottleneck/benchmark
copying bottleneck/benchmark/__init__.py -> build/lib.linux-x86_64-3.5/bottleneck/benchmark
copying bottleneck/LICENSE -> build/lib.linux-x86_64-3.5/bottleneck
running build_ext
building 'bottleneck.reduce' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/bottleneck
creating build/temp.linux-x86_64-3.5/bottleneck/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-FZMKe6/python3.5-3.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/bluehelmet/virtualenv/zipline/lib/python3.5/site-packages/numpy/core/include -I/usr/include/python3.5m -I/home/bluehelmet/virtualenv/zipline/include/python3.5m -c bottleneck/src/reduce.c -o build/temp.linux-x86_64-3.5/bottleneck/src/reduce.o -O2
In file included from bottleneck/src/reduce.c:1:0:
bottleneck/src/bottleneck.h:4:10: 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
----------------------------------------
Failed building wheel for bottleneck
Running setup.py clean for bottleneck
Running setup.py bdist_wheel for bcolz ... error
Complete output from command /home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/bcolz/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-uga7q655 --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/bcolz
copying bcolz/utils.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/ctable.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/py2help.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/version.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/toplevel.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/attrs.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/chunked_eval.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/py2help_tests.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/__init__.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/arrayprint.py -> build/lib.linux-x86_64-3.5/bcolz
copying bcolz/defaults.py -> build/lib.linux-x86_64-3.5/bcolz
creating build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/common.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_attrs.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_ndcarray.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_queries.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_carray_objects.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/__init__.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_carray.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/test_ctable.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/tests/all.py -> build/lib.linux-x86_64-3.5/bcolz/tests
copying bcolz/carray_ext.pxd -> build/lib.linux-x86_64-3.5/bcolz
running build_ext
skipping 'bcolz/carray_ext.c' Cython extension (up-to-date)
building 'bcolz.carray_ext' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/bcolz
creating build/temp.linux-x86_64-3.5/c-blosc
creating build/temp.linux-x86_64-3.5/c-blosc/blosc
creating build/temp.linux-x86_64-3.5/c-blosc/internal-complibs
creating build/temp.linux-x86_64-3.5/c-blosc/internal-complibs/lz4-r119
creating build/temp.linux-x86_64-3.5/c-blosc/internal-complibs/snappy-1.1.1
creating build/temp.linux-x86_64-3.5/c-blosc/internal-complibs/zlib-1.2.8
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-FZMKe6/python3.5-3.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_LZ4=1 -DHAVE_SNAPPY=1 -DHAVE_ZLIB=1 -Ibcolz -Ic-blosc/blosc -Ic-blosc/internal-complibs/zlib-1.2.8 -Ic-blosc/internal-complibs/snappy-1.1.1 -Ic-blosc/internal-complibs/lz4-r119 -I/home/bluehelmet/virtualenv/zipline/lib/python3.5/site-packages/numpy/core/include -I/usr/include/python3.5m -I/home/bluehelmet/virtualenv/zipline/include/python3.5m -c bcolz/carray_ext.c -o build/temp.linux-x86_64-3.5/bcolz/carray_ext.o
bcolz/carray_ext.c:4:10: 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
----------------------------------------
Failed building wheel for bcolz
Running setup.py clean for bcolz
Running setup.py bdist_wheel for lru-dict ... error
Complete output from command /home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/lru-dict/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-5ckeqmpz --python-tag cp35:
running bdist_wheel
running build
running build_ext
building 'lru' extension
creating build
creating build/temp.linux-x86_64-3.5
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-FZMKe6/python3.5-3.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -I/home/bluehelmet/virtualenv/zipline/include/python3.5m -c lru.c -o build/temp.linux-x86_64-3.5/lru.o
lru.c:1:10: 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
----------------------------------------
Failed building wheel for lru-dict
Running setup.py clean for lru-dict
Failed to build zipline cyordereddict bottleneck bcolz lru-dict
Installing collected packages: cyordereddict, bottleneck, contextlib2, decorator, networkx, numexpr, bcolz, click, toolz, multipledispatch, MarkupSafe, Mako, sqlalchemy, python-editor, alembic, sortedcontainers, intervaltree, lru-dict, empyrical, tables, zipline
Running setup.py install for cyordereddict ... error
Complete output from command /home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/cyordereddict/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-55p6137n/install-record.txt --single-version-externally-managed --compile --install-headers /home/bluehelmet/virtualenv/zipline/include/site/python3.5/cyordereddict:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/cyordereddict
copying python3/cyordereddict/_version.py -> build/lib.linux-x86_64-3.5/cyordereddict
copying python3/cyordereddict/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict
creating build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/magic_timeit.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/benchmark.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
copying python3/cyordereddict/benchmark/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict/benchmark
creating build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/test_ordereddict.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/test_cyordereddict.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/_mapping_tests.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
copying python3/cyordereddict/test/__init__.py -> build/lib.linux-x86_64-3.5/cyordereddict/test
running build_ext
building 'cyordereddict._cyordereddict' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/python3
creating build/temp.linux-x86_64-3.5/python3/cyordereddict
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-FZMKe6/python3.5-3.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -I/home/bluehelmet/virtualenv/zipline/include/python3.5m -c python3/cyordereddict/_cyordereddict.c -o build/temp.linux-x86_64-3.5/python3/cyordereddict/_cyordereddict.o
python3/cyordereddict/_cyordereddict.c:12:10: 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
----------------------------------------
Command "/home/bluehelmet/virtualenv/zipline/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6nfwm6vn/cyordereddict/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-55p6137n/install-record.txt --single-version-externally-managed --compile --install-headers /home/bluehelmet/virtualenv/zipline/include/site/python3.5/cyordereddict" failed with error code 1 in /tmp/pip-install-6nfwm6vn/cyordereddict/
It looks like it have trouble building wheels. After googleing a bit, i couldn't find any solutions. What's your input?
So i found thanks to the comment that i needed to
sudo apt install python3.5-dev
This question is resolved.
Related
I've been trying to solve this problem for a couple of days. I am trying to put my Django project in a venv on cPanel and install mysqlclient. So after setting up my Python (version = 3.7.8) on Cpanel, I installed Django version 3.1.7 and mysqlclient from the terminal using pip install django and pip install mysqlclient. However when I try to install mysqlclient, this error pops out.
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/canggihmallmy/virtualenv/django_test/3.7/bin/python3.7_bin -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/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-scx4wswm
cwd: /tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/
Complete output (43 lines):
mysql_config --version
['10.0.38']
mysql_config --libs
['-L/usr/lib64', '-lmysqlclient', '-lpthread', '-lz', '-lm', '-ldl', '-lssl', '-lcrypto']
mysql_config --cflags
['-I/usr/include/mysql', '-I/usr/include/mysql/..']
ext_options:
library_dirs: ['/usr/lib64']
libraries: ['mysqlclient', 'pthread', 'm', 'dl']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mysql', '/usr/include/mysql/..']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
/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/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 -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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 -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -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 -std=c99
unable to execute 'gcc': Permission denied
error: command '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: /home/canggihmallmy/virtualenv/django_test/3.7/bin/python3.7_bin -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/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-1wxueu88/install-record.txt --single-version-externally-managed --compile --install-headers /home/canggihmallmy/virtualenv/django_test/3.7/include/site/python3.7/mysqlclient
cwd: /tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/
Complete output (43 lines):
mysql_config --version
['10.0.38']
mysql_config --libs
['-L/usr/lib64', '-lmysqlclient', '-lpthread', '-lz', '-lm', '-ldl', '-lssl', '-lcrypto']
mysql_config --cflags
['-I/usr/include/mysql', '-I/usr/include/mysql/..']
ext_options:
library_dirs: ['/usr/lib64']
libraries: ['mysqlclient', 'pthread', 'm', 'dl']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mysql', '/usr/include/mysql/..']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
/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/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 -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -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 -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -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 -std=c99
unable to execute 'gcc': Permission denied
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/canggihmallmy/virtualenv/django_test/3.7/bin/python3.7_bin -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct08p_k4/mysqlclient_5cd61bc8b4de40efb5731cfe082b4d65/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-1wxueu88/install-record.txt --single-version-externally-managed --compile --install-headers /home/canggihmallmy/virtualenv/django_test/3.7/include/site/python3.7/mysqlclient Check the logs for full command output. ```
I have tried some of the guide from , such as `yum install mysql` and sudo commands but to no avail.
Please help.
I had the same problem. After days of research I found this solution. I hope this works with your problem too.
Terminal
pip install mysql-connector-python
settings.py
DATABASES = {
'default': {
'NAME': 'DATEBASE_NAME',
'ENGINE': 'mysql.connector.django',
'USER': 'USERNAME',
'PASSWORD': 'PASSWORD',
'OPTIONS': {
'autocommit': True,
},
}
}
Terminal
python manage.py makemigrations
python manage.py migrate
This question already has answers here:
How to install libpq-fe.h?
(4 answers)
Closed 2 years ago.
I get the following error when trying to install psycopg2:
(venv) root#scw-determined-panini:/app# pip install psycopg2
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/a8/8f/1c5690eebf148d1d1554fc00ccf9101e134636553dbb75bdfef4f85d7647/psycopg2-2.8.5.tar.gz
Building wheels for collected packages: psycopg2
Running setup.py bdist_wheel for psycopg2 ... error
Complete output from command /app/venv/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-psll6xe_/psycopg2/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/tmp52or8xexpip-wheel- --python-tag cp38:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
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 -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120004 -DHAVE_LO64=1 -I/app/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:0:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
#include <libpq-fe.h>
^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
Complete output from command /app/venv/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-psll6xe_/psycopg2/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-x62dcj9d-record/install-record.txt --single-version-externally-managed --compile --install-headers /app/venv/include/site/python3.8/psycopg2:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
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 -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120004 -DHAVE_LO64=1 -I/app/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:0:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
#include <libpq-fe.h>
^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/app/venv/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-psll6xe_/psycopg2/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-x62dcj9d-record/install-record.txt --single-version-externally-managed --compile --install-headers /app/venv/include/site/python3.8/psycopg2" failed with error code 1 in /tmp/pip-build-psll6xe_/psycopg2/
(venv) root#scw-determined-panini:/app# psycopg2-binary
psycopg2-binary: command not found
(venv) root#scw-determined-panini:/app# pip install psycopg2-binary
Requirement already satisfied: psycopg2-binary in ./venv/lib/python3.8/site-packages
For Ubuntu use
sudo apt install libpq-dev
thanks
While installing mysqlclient using pip3 install mysqlclient I am geting an error "Failed building wheel for mysqlclient".
I tried using sudo apt-get install python3.6-dev libmysqlclient-dev but didn't work. I am using ubuntu 18.04.2 LTS and python 3.6.8. I was trying to install the mysqlclient in a virtual env.
The mysql server is working fine. I used the same method to install on a local windows machine and it worked fine but i can seem to make it work on server. Any ideas on why this happening. Any suggestions will be appreciated.
Error
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/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/pip-wheel-345d65je --python-tag cp36
cwd: /tmp/pip-install-cl9xqcgy/mysqlclient/
Complete output (31 lines):
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/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python3.6m -I/home/abhishek/Django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
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: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/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-record-m81sgzux/install-record.txt --single-version-externally-managed --compile --install-headers /home/abhishek/Django/include/site/python3.6/mysqlclient
cwd: /tmp/pip-install-cl9xqcgy/mysqlclient/
Complete output (31 lines):
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/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python3.6m -I/home/abhishek/Django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/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-record-m81sgzux/install-record.txt --single-version-externally-managed --compile --install-headers /home/abhishek/Django/include/site/python3.6/mysqlclient Check the logs for full command output.
The actual error is here:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
That means you do not have SSL development headers installed. You can install them like this:
sudo apt-get install libssl-dev
It worked on Windows because PyPI has binary packages available for Windows. There are no binary packages for Linux, so pip has to compile from source, which requires the development headers.
This question already has answers here:
setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 [closed]
(38 answers)
Closed 3 years ago.
I want to install mysqlclient in my ubuntu server.
python version is 3.7.4.
But I can't install this package.(It installed well in 3.6.5)
This is Error message.
(tmp) ubuntu#orcinus:~$ pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/tmp/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4oxpmvqx/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4oxpmvqx/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/pip-wheel-1lcdb63b --python-tag cp37
cwd: /tmp/pip-install-4oxpmvqx/mysqlclient/
Complete output (29 lines):
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
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 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/include/mysql -I/usr/include/python3.7m -I/home/ubuntu/tmp/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:38:20: fatal error: Python.h: No such file or directory
compilation terminated.
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: /home/ubuntu/tmp/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4oxpmvqx/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4oxpmvqx/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-record-1f31t3fb/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/tmp/include/site/python3.7/mysqlclient
cwd: /tmp/pip-install-4oxpmvqx/mysqlclient/
Complete output (29 lines):
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
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 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/include/mysql -I/usr/include/python3.7m -I/home/ubuntu/tmp/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:38:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ubuntu/tmp/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4oxpmvqx/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4oxpmvqx/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-record-1f31t3fb/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/tmp/include/site/python3.7/mysqlclient Check the logs for full command output.
What should I do?
I must use mysqlclient not pymysql.
Stackoverflow says add some more details.. but I don't know what should I add more.
Thank you.
You need to install python version specific python-dev. In your case you need to install python-dev for python3.7
sudo apt-get install python3.7-dev
source
install this:
sudo apt-get install python3-dev
Like many people, I am having issues getting mysql and python to work together. My specs are:
OSX10.9.2
Anaconda 1.9.1 with python 2.7.2, although 2.5 and 2.6 appear to be included
MySQL 5.6.16
I have written a python script where I try to import MySQLdb, or PyMySQL then MySQLdb, neither works.
I read many of the threads on stack overflow, and as a result I eventually tried
$ export CFLAGS=-Qunused-arguments
$ export CPPFLAGS=-Qunused-arguments
$ pip install mysql-python
The results are below. A fatal error was issued, as can be seen at the bottom of the output.
Downloading/unpacking mysql-python
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py) egg_info for package mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info=(1,2,5,'final',1) -D_version_=1.2.5 -I/usr/local/mysql/include -I/Users/vincentlaufer/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
In file included from _mysql.c:29:
/Users/vincent/anaconda/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Complete output from command /Users/vincentlaufer/anaconda/bin/python -c "import setuptools, tokenize;file='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip-6aqGYj-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.5-x86_64-2.7
/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info=(1,2,5,'final',1) -D_version_=1.2.5 -I/usr/local/mysql/include -I/Users/vincent/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
In file included from _mysql.c:29:
/Users/vincent/anaconda/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
include stdio.h
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Cleaning up...
Command /Users/vincent/anaconda/bin/python -c "import setuptools, tokenize;file='/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip-6aqGYj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/T/pip_build_vincent/mysql-python
Storing debug log for failure in /Users/vincentlaufer/.pip/pip.log
I would like to thank everyone for the many answers provided that got me this far already, but also to ask if anyone knows how to solve this issue. Thank you!!
Inclusion of the line:
$ xcode-select --install
solves this problem, as per: GCC fatal error: stdio.h: No such file or directory