[Django]-Python 3.7, Failed building wheel for MySql-Python

24👍

You need to install the following dependencies before installing mysqlclient for python 3.7 in your system.

sudo apt-get install python3.7-dev default-libmysqlclient-dev

I hope this will help you.

23👍

I installed the following library on Ubuntu and after that, the issue got resolved.

sudo apt-get install libssl-dev

and then I was able to install mysqlclient using the following command

pip install mysqlclient
👤Junaid

5👍

currently the mysql-connector for python 3.7 is not available in official wesite but u can fix this issue by installing wheel with specific windows and python version.
this solutionpip install (ex/dir)/mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl for win 64-bi and python 3.7

check the link below and download the specific wheel for your system.
download and install the wheel for specific version by using “pip install (full path with file name in my case ex:-“pip install C:\Users\%user%\Downloads\mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl”)

5👍

This should work.

Do this first

sudo apt-get install python3.7-dev

And Then

pip install mysqlclient

4👍

I installed it with the following command and works well now (on Mac):
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient

see connected answer:
Error installing mysql-python: library not found for -lssl

3👍

You have to install “mysqlclient-1.4.1-cp37-cp37m-win32.whl” (32bit) file

  1. Download 32bit file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
  2. if your file is in Downloads folder write the command in your cmd

    i. cd C:\Users\Nour Noby\Downloads [“Nour Noby” should be changed ]

    ii. pip install mysqlclient-1.4.1-cp37-cp37m-win32.whl
    [“mysqlclient-1.4.1-cp37-cp37m-win32.whl” should be replaced with your downloaded filename ].

2👍

As of 2019, here is how to run smoothly pip install mysqlclient on MacOS:

brew info openssl and follow the commands at the bottom

  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

Other approaches:

  • brew install/upgrade/reinstall mysql : did not fix the issue for me, but has the nice side effect to make sure your installation is clean.
  • brew install mysql-connector-c : to make that work you have to unlink mysql, which ruins your setup and it did not fix the issue for me.

2👍

ensuring you have had done the needful with python…

and installing on the global level… (not virtual environment)

sudo apt-get install mysql-server
pip install --upgrade setuptools

I had come across the same problem, because I installed default Python2.7.15, and python3 would break even after doing the needful for Python (being python2)

something that worked for me was (effectively the last one is what made it work, but i think they were equally required on my virtualenvironment with python3)

sudo apt-get install libmysqlclient-dev
sudo apt-get install python3-pymysql
sudo apt-get install python3.6-dev

python3.7 in your case in the virtualenv

I also had to go through..

👤Mehdi

0👍

use this command :
sudo apt-get install libssl-dev

0👍

In my case, I had the 32-bit version of Python installed, instead of the 64-bit one. Install 64-bit Python and it would work alright.

0👍

0👍

try to change python3 to python or python3.7-dev or as installed on your machine.

sudo apt-get install python3 default-libmysqlclient-dev

-2👍

Use Anaconda and execute
conda install mysqlclient

Leave a comment