I am building a django app and for which i need to configure mysql.I am trying to install mysqlclient module for sql connection and this is what i am trying
pip install mysqlclient --no-cache-dir
It is throwing me following error.It is throwing error while linking to gcc library.
Collecting mysqlclient
Downloading mysqlclient-1.3.12.tar.gz (89kB)
100% |################################| 92kB 4.0MB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /home/admin/awx.varadev.com/awxenv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-6m2TNP/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-WFoARo-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/admin/awx.varadev.com/awxenv/include/site/python2.7/mysqlclient:
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/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.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/CLIENT.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/ER.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/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
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -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 -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=(1,3,12,'final',0) -D__version__=1.3.12 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from /usr/include/python2.7/pyconfig.h:6:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:32:
/usr/include/python2.7/pyconfig-64.h:1188:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/sys/types.h:25:0,
from /usr/include/mysql/mysql.h:38,
from _mysql.c:29:
/usr/include/features.h:168:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:32:
/usr/include/python2.7/pyconfig-64.h:1210:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/sys/types.h:25:0,
from /usr/include/mysql/mysql.h:38,
from _mysql.c:29:
/usr/include/features.h:170:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/lib64 -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/admin/awx.varadev.com/awxenv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-6m2TNP/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-WFoARo-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/admin/awx.varadev.com/awxenv/include/site/python2.7/mysqlclient" failed with error code 1 in /tmp/pip-build-6m2TNP/mysqlclient/
is this gcc default feature to link a library file for mysql? I have googled on this and it showing that gcc needs as .so file which i need to symlink with some location.I am running mariadb 10.9 on my server and i did not find any such file in my system.
Solved in CentOS 7 + MariaDB 10.2
I'm having same issue, and I would like to contribute with my answer. I've just installed in my 2 servers running CentOS 7 with MariaDB (10.2.14-MariaDB MariaDB Server)
.
$ cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
$ mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is XXXX
Server version: 10.2.14-MariaDB MariaDB Server
I've installed MariaDB, this packages:
$ yum list installed | grep mariadb
MariaDB-client.x86_64 10.3.13-1.el7.centos #mariadb
MariaDB-common.x86_64 10.3.13-1.el7.centos #mariadb
MariaDB-compat.x86_64 10.3.13-1.el7.centos #mariadb
MariaDB-server.x86_64 10.3.13-1.el7.centos #mariadb
galera.x86_64 25.3.25-1.rhel7.el7.centos #mariadb
I found that the problem is that mysqlclient requires mysql-devel packages, which is different from mariadb-devel. Don't install mariadb-devel!
So, to install only mysql-devel, you need to:
1. Remove any MariaDB-devel
$ sudo yum erase MariaDB-devel.x86_64
2. Add MySQL repository in yum
Go to https://dev.mysql.com/downloads/repo/yum/ and select the RPM file for your CentOS (for me, I choose "Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package". Click "download".)
Download without registration, copy bottom link "No thanks, just start my download".
Go to your terminal and type:
$ wget link-to-rpm-you-choose
After download complete, type:
$ sudo rpm -Uvh your-rpm-downloaded
3. Now, install mysql-devel
Type (this is my version, watch yours):
$ sudo yum install mysql-community-devel.x86_64
4. Now, finally: mysqlclient
Type:
$ sudo pip install mysqlclient
Collecting mysqlclient
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
100% |████████████████████████████████| 92kB 758kB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.4.2.post1
You are using pip version 8.1.2, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
And that's it! It worked like a charm and now I can use Python + Django + MariaDB/MySQL
Oh, and mysqlclient is the connector recommended by Django. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-db-api-drivers
Good luck and see ya! :-)
I found this solution at https://github.com/r-dbi/RMySQL/issues/197:
The MariaDB-devel-10.2.6-1.fc25.x86_64 package contains only a library named:
/usr/lib64/libmariadbclient.a
However their pkg-config yields another name:
> pkg-config --libs mariadb
-lmariadb
A workaround is to symlink libmariadbclient.a to libmariadb.a:
sudo ln -s /usr/lib64/libmariadbclient.a /usr/lib64/libmariadb.a
Basically to have mysqlclient install in Python 3.6 and CentOS 7 you need to run:
sudo yum install -y python36-devel mysql-devel gcc
sudo ln -s /usr/lib64/libmariadbclient.a /usr/lib64/libmariadb.a
pip install mysqlclient
It's complaining about not being able to find mariadb libs. Run the following to find out why:
ld -lmariadb --verbose
This should tell you specifically what gcc is missing.
My guess is that you are missing some MySQL development headers. Install them with:
debian / ubuntu: sudo apt-get install python-dev libmysqlclient-dev
redhat / centos: sudo yum install python-devel mysql-devel
Update: It really is missing MariaDB shared libs. I think on CentOS, this should take care of it:
sudo yum install MariaDB-devel
Final Update: Just use PyMySQL - pure python, no headers required, no need to jump through these kinds of hoops.
The simplest solution that worked for me is:
yum install python-devel mysql-devel
Then install mysqlclient using pip
pip install mysqlclient
Open the terminal or login to the workstation/laptop/dev-server using ssh client. Type the following command yum command as a root user:
# yum install mysql
Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.wiredtree.com
* extras: mirrors.serveraxis.net
* updates: bay.uchicago.edu
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.71-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mysql x86_64 5.1.71-1.el6 base 893 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 893 k
Installed size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
mysql-5.1.71-1.el6.x86_64.rpm | 893 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mysql-5.1.71-1.el6.x86_64 1/1
Verifying : mysql-5.1.71-1.el6.x86_64 1/1
Installed:
mysql.x86_64 0:5.1.71-1.el6
Complete!
mysql client the basic syntax is:
mysql -u USER-NAME-HERE -h MYSQL-DB-SERVER-IP-ADDRESS-HERE -p DB-NAME
mysql -u nixcraft -h server1.cyberciti.biz -p salesdata
Related
I installed Python 2.7.15rci and Python 3.6.7 on Ubuntu. When i did 'pip list' on virtualenv it returns me:
Django (2.1.5)
pip (9.0.1)
pkg-resources (0.0.0)
pytz (2018.9)
setuptools (39.0.1)
wheel (0.32.3)
I'm trying to install mysqlclient (pip install mysqlclient) and returns an error.
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
----------------------------------------
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/david/env/project/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pq18uxjj/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-y28h4ou0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/david/env/project/include/site/python3.6/mysqlclient:
/usr/lib/python3.6/distutils/dist.py:261: 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.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,1,'final',0) -D__version__=1.4.1 -I/usr/include/mysql -I/home/david/env/project/include -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/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
----------------------------------------
Command "/home/david/env/project/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pq18uxjj/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-y28h4ou0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/david/env/project/include/site/python3.6/mysqlclient" failed with error code 1 in /tmp/pip-build-pq18uxjj/mysqlclient/
So, I have tried different methods found like:
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install libmysqlclient-dev
and some more... but none of them work for me and the problem persists.
Any suggestions?
Thank you!
gcc is part of the build-essential package, which you should install before anything else:
sudo apt-get install build-essential
UPDATE: Following #bosnjak's suggestion, you also might need to install the openssl developer tools:
sudo apt-get install libssl-dev
I specified the particular version of python it's 3.7
And that helped me
I have installed these ones:
sudo apt-get install python3.7-dev libmysqlclient-dev
And then installed mysqlclient by:
pip install mysqlclient
I turned out, that the solution is slightly different for almost every Python version. For those using different versions, such as Python 2.x, 3.5 or 3.7 I found this:
Part I
For Python 2.x use:
$ sudo apt-get install python-dev
For Python 2.7 use:
$ sudo apt-get install libffi-dev
For Python 3.x use:
$ sudo apt-get install python3-dev
For Python 3.4 use:
$ sudo apt-get install python3.4-dev
For Python 3.7 use:
$ sudo apt-get install python3.7-dev
For Python 3.8 use:
$ sudo apt-get install python3.8-dev
For Python 3.9 use:
$ sudo apt-get install python3.9-dev
Part II
If this still doesn't help, others have pointed out to install
$ sudo apt-get install build-essential
and finally
$ sudo apt-get install libssl-dev
But the last two didn't help myself - but hoping this might help you!
You may do this before:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Source: https://pypi.org/project/mysqlclient/
This issue was persistent in Ubuntu and python 3+. In my case, I was using Ubuntu 18.04 and found this solution to be useful for python version 3.7.5
Step 1. Install libpython3.7-dev via sudo apt
> sudo apt-get install libpython3.7-dev
Step 2: Install mysqlclient
> python3 -m pip install mysqlclient==1.4.6
I wanted to install the 'Modoboa' mail-server package (https://github.com/modoboa/modoboa) on my Ubuntu 18.04 with Apache as my webserver, instead of nginx. I needed mysqlclient for Python 2.7. The following packages worked for me:
sudo apt-get install libssl-dev gcc python2.7-dev libmysqlclient-dev
I'm using the python3.8. Similarly to david's answer, use the following command then it works.
$ sudo apt-get install python3.8-dev
I have installed tools via xcode-select --install but still show the following error while doing pip install MySQL-python
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command /Users/vaibhavmule/Envs/switchidea/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-install-SD9Cgh/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/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-wheel-g6C50k --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.13-x86_64-2.7
creating build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.13-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/8.0.11/include/mysql -I/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-x86_64-2.7/_mysql.o
_mysql.c:36:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
django-model-utils 3.0.0 has requirement Django>=1.8, but you'll have django 1.6.7 which is incompatible.
faker 0.8.16 has requirement six>=1.10, but you'll have six 1.6.1 which is incompatible.
django-phonenumber-field 2.0.0 has requirement Django>=1.11, but you'll have django 1.6.7 which is incompatible.
Installing collected packages: MySQL-python, opbeat, olefile, Pillow, pyzmq, contextlib2, raven, simplejson, South, sqlparse, wheel, django-sendfile, httplib2, pytz, twilio, phonenumberslite, babel, django-phonenumber-field, django-twilio, text-unidecode, python-dateutil, Faker, factory-boy, waitress, beautifulsoup4, WebOb, webtest, django-webtest, coverage
Running setup.py install for MySQL-python ... error
Complete output from command /Users/vaibhavmule/Envs/switchidea/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-install-SD9Cgh/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/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-record-ihy3we/install-record.txt --single-version-externally-managed --compile --install-headers /Users/vaibhavmule/Envs/switchidea/bin/../include/site/python2.7/MySQL-python:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.13-x86_64-2.7
creating build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.13-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/Cellar/mysql/8.0.11/include/mysql -I/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-x86_64-2.7/_mysql.o
_mysql.c:36:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/vaibhavmule/Envs/switchidea/bin/python2.7 -u -c "import
setuptools, tokenize;__file__='/private/var/folders/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-install-SD9Cgh/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/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-record-ihy3we/install-record.txt --single-version-externally-managed --compile --install-headers /Users/vaibhavmule/Envs/switchidea/bin/../include/site/python2.7/MySQL-python" failed with error code 1 in /private/var/folders/p6/0v0bflxn3t399_qdpnm2z7hc0000gn/T/pip-install-SD9Cgh/MySQL-python/
I just resolved this exact issue when running Ansible's mysql_user module. The answer here helped tip me off to a solution. I also needed MySQL-python from pip, which also broke in this process, so I've added the extra steps.
Steps to resolve:
brew unlink mysql # only if installed, causes the next step to fail
brew install mysql-connector-c
locate mysql_config file with which (mysql_config)
edit the mysql_config file, under # Create options change this:
libs="$libs -l "
to this:
libs="$libs -lmysqlclient -lssl -lcrypto"
if using vim, :wq! to save the read-only file
Now the install should run successfully
pip install mysqlclient
Adding this separately, as it's similar but not directly related to the initial question
pip install MySQL-python
Fix mysql brew formula, if it was unlinked in the first step.
brew unlink mysql-connector-c
brew link mysql
I fixed it by passing the OpenSSL path:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysqlclient
You can see the full article of the solution done by MrWeeble
I solved this issue by setting xcode-select to use non-XCode command line tools, as shown in the below answer. I had a related clang error which led me to this answer.
sudo xcode-select --switch /Library/Developer/CommandLineTools
https://stackoverflow.com/a/30902106/11614142
I know maybe the former answers can solve the problem already. But I'm still sharing below solution. If you don't want to brew install any extra things, you can try this solution.
I think the issue happens in many situations, mainly related to the installation of the pip packages about MySQL. In my case, I bumped into this issue when trying to install mysqlclient for Django.
This solution should work when you've installed MySQL with dmg downloaded from their official site.
In that case, you may find mysql_config in /usr/local/mysql/bin
If so, add export PATH="/usr/local/mysql/bin:${PATH}" in ~/.bash_profile, this would add the bin folder of mysql into the PATH, or you can say environment variable. Please note that mysql maybe in detail with your mysql version. In my case, the path is /usr/local/mysql-8.0.12-macos10.13-x86_64/bin.
Save and close the file, then source ~/.bash_profile to enable the change.
Try to install the pip package about MySQL again.
If still not working, a restart is preferred.
None of these answers are really needed in that length. As Vishal noted it is as easy as
brew install openssl
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
Then go back to install your pip install -r requirements.txt
So first what is clang? it is a "compiler frontend" for C, C++. What is a compiler frontend you may ask? See this answer for more details. You're trying to install a library (mysqlclient or apache-airflow[mysql] or any other) that requires some C++ dependency to be found but is not, hence the message that looks like:
#include "my_config.h"
^~~~~~~~~~~~~
The clang error messages are pretty verbose so you might miss the important information. What's important are those 3 lines:
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Find that first line before "command 'clang' failed", this will tell you what library was not found.
If the library was not found, it could be because it's not installed (hence all the brew install ... answers here) or because it's not found in the path (hence all the export LDFLAGS=... and export LIBRARY_PATH=... answers).
In my case, 2 librairies were not found but both were installed, so I solved it with:
export LDFLAGS="-L/usr/local/Cellar/openssl#1.1/1.1.1l/lib -L/usr/local/Cellar/zstd/1.5.0/lib"
pip install 'apache-airflow[mysql]'
This is not a direct answer to OP, but hopefully helpful in some way.
I tried this,
export ARCHFLAGS="-arch x86_64"
Then re-execute the installation command. It's resolved for me.
Following did the trick for me, Using mac.
brew install leveldb gmp pkg-config
After this just run
pip3 install MySQL-python
I want to run django with MySQL and Python 3. I initialized virtual environment with virtualenv --no-site-packages -p python3 ./. Then I installed django and wheel using pip, so pip freeze gives
django==1.8.3
wheel==0.24.0
Then I tried installing mysqlclient with pip install mysqlclient, but it ended with
Downloading/unpacking mysqlclient
Downloading mysqlclient-1.3.6.tar.gz (78kB): 78kB downloaded
Running setup.py (path:/tmp/pip-build-jpdlrnc8/mysqlclient/setup.py) egg_info for package mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient
building '_mysql' extension
i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/usr/include/python3.4m -I/home/ondra/zelvovani/include/python3.4m -c _mysql.c -o build/temp.linux-i686-3.4/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DTAOCRYPT_DISABLE_X86ASM -g -DNDEBUG
error: command 'i586-linux-gnu-gcc' failed with exit status 1
Complete output from command /home/ondra/zelvovani/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-jpdlrnc8/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fa_6nkh3-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ondra/zelvovani/include/site/python3.4:
running install
running build
running build_py
creating build
creating build/lib.linux-i686-3.4
copying _mysql_exceptions.py -> build/lib.linux-i686-3.4
creating build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-3.4/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-3.4/MySQLdb
creating build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-3.4/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-3.4/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-3.4
i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/usr/include/python3.4m -I/home/ondra/zelvovani/include/python3.4m -c _mysql.c -o build/temp.linux-i686-3.4/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DTAOCRYPT_DISABLE_X86ASM -g -DNDEBUG
error: command 'i586-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /home/ondra/zelvovani/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-jpdlrnc8/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fa_6nkh3-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ondra/zelvovani/include/site/python3.4 failed with error code 1 in /tmp/pip-build-jpdlrnc8/mysqlclient
Storing debug log for failure in /home/ondra/.pip/pip.log
I have installed libmysqlclient-dev, python3-dev, zlib1g-dev (packages that were suggested in other questions here in stackoverflow).
Do you have any ideas, what am I doing wrong?
Use pymysql and it should solve your problem.Use pip3 install pymysql. After installing , in file directory project/project/__init__.py write this
import pymysql
pymysql.install_as_MySQLdb()
Note:- project is the name of your django project.
You can try installing python3-dev and libmysqlclient-dev as the documentation says. I had the same problem until I noticed about I needed those packages.
If you're using python 3.5 or 3.6 you should be having the problem described in this issue.
Quoting one of the contributors to this library:
Building MySQL-python on Windows is hard. You should build from source instead of pip install since you need to edit setup.cfg file.
Thankfully there is an Unofficial Windows Binaries for Python Extension Packages by Christoph Gohlke (Laboratory for Fluorescence Dynamics, University of California, Irvine) and there you can download wheels (.whl) for this library:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Download according to your system and python version installed.
Then you just need to do (in the directory of the downloaded file):
pip install mysqlclient-....whl
If You are using Linux:
As mentioned in the pypi guide of installing mysqlclient,
You may need to install the Python 3 and MySQL development headers and libraries like so
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Note:
( Replace python3 with your python version ) e.g
sudo apt-get install python3.8-dev default-libmysqlclient-dev build-essential
This generally happens if you have multiple versions of python installed in your system. First, uninstall mysqlclient and pymysql globally (if installed):
pip3 uninstall mysqlclient
pip3 uninstall pymysql
Now, go to you project and remove venv
sudo rm -r venv
If using pycharm, it will popup for setting up an interpreter. Select python3.6 as your interpreter and create a virtual environment. If not using pycharm,
python3 -m virtualenv venv
source venv/bin/activate
Now, install mysqlclient,
pip3 install mysqlclient
This should work!
The problem occurs whilst compiling binaries and there are two possible solutions
Use pre-compiled binaries from third part websites like lfd (only for windows)
Install the header files through python dev package which are necessary for compilation as if you want to build extensions, you need to install the corresponding dev package. Use your package manager to install them system-wide and don't forget to mention specific python version you are using for your project. As of Ubuntu, python 3.6 is default version but my virtual environment was set for python3.7 and i had to specifically install development package by
apt-get install python3.7-dev
This is my first answer over stackoverflow. I hope it will help someone.
Note the following steps:
Microsoft Visual C++ 14.0 is required. Download it in HERE
Downloads mysqlclient in HERE
Here's a list of compatible mysqlclient and python:
mysqlclient‑1.4.6‑cp39‑cp39‑win_amd64.whl --> python 3.9 (64 bit)
mysqlclient‑1.4.6‑cp39‑cp39‑win32.whl --> python 3.9 (32 bit)
mysqlclient‑1.4.6‑cp38‑cp38‑win_amd64.whl --> python 3.8 (64 bit)
mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl --> python 3.8 (32 bit)
mysqlclient‑1.4.6‑cp37‑cp37m‑win_amd64.whl --> python 3.7 (64 bit)
mysqlclient‑1.4.6‑cp37‑cp37m‑win32.whl --> python 3.7 (32 bit)
mysqlclient‑1.4.6‑cp36‑cp36m‑win_amd64.whl --> python 3.6 (64 bit)
mysqlclient‑1.4.6‑cp36‑cp36m‑win32.whl --> python 3.6 (32 bit)
Downloads mysql based on your python version
Install mysql --> pip3 install mysqlclient‑1.4.6.xxxxx.whl
Done
You can easily install the mysqlclient in python3.* virtual environment or at system level just follow these steps:
First, install:
$ sudo apt-get install gcc libssl-dev
$ sudo apt-get install python3.6-dev libmysqlclient-dev
Don't forget to update the python version as per your need, and for python2.7 use
$ sudo apt-get install python-dev libmysqlclient-dev
Now simply install the MySQL client using this command:
$ pip install mysqlclient
If you're installing the same at the system level then add sudo in the beginning of the command.
Note:
Whenever you create a python virtual environment, always update the pip and setuptools before proceeding with the requirements installation:
$ pip install pip setuptools -U
I had a problem installing mysqlclient python 3.9 32 bit.
I solved it thanks to the advice from the official documentation.
Install Section for windows
After installed MariaDB Connector/C 32 bit version.
pip install mysqlclient
Ran without errors
Download the pre-compiled whl file for mysqlclient according to your OS from Christophe Gohlke’s Library of pre-compiled python packages for windows from the below location.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#vlfd
Now got to directory where you downloaded that file and open command prompt there.
Now run below command
pip install xxx.whl
Best Luck !!
I am installing cffi package for cryptography and Jasmin installation.
I did some research before posting question, so I found following option but which is seems not working:
System
Mac OSx 10.9.5
python2.7
Error
c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
#include <ffi.h>
^
1 warning and 1 error generated.
Please guide me on following issue.
Thanks
Command
env DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib/ ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" sudo -E pip install cffi
LOG
bhushanvaiude$ env DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib/ ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" sudo -E pip install cffi
Password:
Downloading/unpacking cffi
Downloading cffi-0.8.6.tar.gz (196kB): 196kB downloaded
Running setup.py egg_info for package cffi
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
1 warning generated.
Downloading/unpacking pycparser (from cffi)
Downloading pycparser-2.10.tar.gz (206kB): 206kB downloaded
Running setup.py egg_info for package pycparser
Installing collected packages: cffi, pycparser
Running setup.py install for cffi
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
1 warning generated.
building '_cffi_backend' extension
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -Qunused-arguments -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -DUSE__THREAD -I##HOMEBREW_CELLAR##/libffi/3.0.13/lib/libffi-3.0.13/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-intel-2.7/c/_cffi_backend.o
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
#include <ffi.h>
^
1 warning and 1 error generated.
error: command 'cc' failed with exit status 1
Complete output from command /Users/****project path***/bin/python -c "import setuptools;__file__='/Users/****project path***/build/cffi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/7w/8z_mn3g120n34bv0w780gnd00000gn/T/pip-e6d6Ay-record/install-record.txt --single-version-externally-managed --install-headers /Users/****project path***/include/site/python2.7:
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
1 warning generated.
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
creating build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/__init__.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/api.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/backend_ctypes.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/commontypes.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/cparser.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/ffiplatform.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/gc_weakref.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/lock.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/model.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/vengine_cpy.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/vengine_gen.py -> build/lib.macosx-10.9-intel-2.7/cffi
copying cffi/verifier.py -> build/lib.macosx-10.9-intel-2.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/c
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -Qunused-arguments -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -DUSE__THREAD -I##HOMEBREW_CELLAR##/libffi/3.0.13/lib/libffi-3.0.13/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-intel-2.7/c/_cffi_backend.o
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
#include <ffi.h>
^
1 warning and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
In your terminal try and run:
xcode-select --install
After that try installing the package again.
By default, XCode installs itself as the IDE and does not set up the environment for the use by command line tools; for example, the /usr/include folder will be missing.
Running the above command will install the tools necessary to run compilation from the command line and create the required symbolic links. Since Python packages compile native code parts using the command-line interface of XCode, this step is required to install Python packages that include native components.
You only need to do this once per XCode install/upgrade, or if you see a similar error.
Install CLI development toolchain with
$ xcode-select --install
If you have a broken pkg-config, unlink it with following command as mentioned in comments.
$ brew unlink pkg-config
Install libffi package
$ brew install pkg-config libffi
and then install cffi
$ pip install cffi
Source: Error installing bcrypt with pip on OS X: can't find ffi.h (libffi is installed)
Running the below command in terminal took care of my issue.
xcode-select --install
I'm trying to install the new Regex module
The readme.txt says:::
To build and install regex for your default Python run
python setup.py install
To install regex for a specific version run setup.py with that interpreter, e.g.
python3.1 setup.py install
I type in python setup.py install and get back /Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
I'm looking for the answer but people keep referring me to the Python docs and they are confusing.
I know it is really simple but I'm just not sure why it isn't working.
The implicit first step in these instructions is to download a tarball or zip file of regex, unpack it, go into that directory, and there run “python setup.py install”. See http://docs.python.org/2/install/index.html#the-new-standard-distutils
If you have pip installed, you can avoid these manual steps by running “pip install regex”.
It's Easy (On Mac):
Install easy_install
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python
Install pip
sudo easy_install pip
Install regex module
pip install regex
On Ubuntu and Python3.5, I was having an issue where it wasn't compiling when I try to install regex with pip ( pip install regex) :
Building wheels for collected packages: regex
Running setup.py bdist_wheel for regex ... error
Complete output from command /var/www/envs/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i08laat0/regex/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-xlh43fe_ --python-tag cp35:
/var/www/envs/lib/python3.5/site-packages/setuptools/dist.py:397: UserWarning: Normalizing '2018.02.21' to '2018.2.21'
normalized_version,
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying regex_3/regex.py -> build/lib.linux-x86_64-3.5
copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.5
copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.5
running build_ext
building '_regex' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/regex_3
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/usr/include/python3.5m -I/var/www/envs/include/python3.5m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.5/regex_3/_regex.o
regex_3/_regex.c:46: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 regex
Running setup.py clean for regex
Failed to build regex
Solved that by installing python3-dev : sudo apt-get install python3-dev