Unable to install mysqlclient on Ubuntu 20.10
Solution 1
Check this thread, maybe it helps you.
Error installing libmysqlclient-dev on Ubuntu 20.04
Step 0: sudo apt install python3-dev build-essential
Step 1: sudo apt install libssl1.1
Step 2: sudo apt install libssl1.1=1.1.1f-1ubuntu2
Step 3: sudo apt install libssl-dev
Step 4: sudo apt install libmysqlclient-dev
Step 5: pip3 install mysqlclient
That's it!
ps: To find out these all steps, I was spent almost 4-5 Hours. :D
Solution 2
As mentioned here you should do:
-
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Debian / Ubuntu -
sudo yum install python3-devel mysql-devel
Red Hat / CentOS
After that just do pip install mysqlclient
Solution 3
This can usually be resolved with the libffi-dev
libraries; libffi.so
specifically. It can be installed via apt
with:
sudo apt install libffi-dev
Note: I have not found a way to install this via pip3
. Do let me know if you find it somewhere.
Once libffi-dev
is installed, run ldconfig
to load the new .so
.
Important: If you compiled your own Python installation, then you will need to recompile it for libffi-dev
to be loaded.
Related videos on Youtube
Shivangi Varshney
Updated on September 18, 2022Comments
-
Shivangi Varshney over 1 year
I want to install MySQL on my Ubuntu 20.10 desktop, but I'm facing issues. I tried installing
python3-dev
andlibmysqlclient-dev
.When running:
pip3 install mysqlclient
I keep getting the error below:
How may I solve this?
-
Shivangi Varshney about 3 years@BeastofCarerbannog I did install libffi-dev and executed ldconfig. Still getting the same error. While doing pip install mysqlclient. The error is still the same.
-
-
Mai Hai over 2 yearsIt works for Ubuntu 18.04 too.
-
FisNaN about 2 yearsI have venv set to Python 3.9. In my case, I use
sudo apt install python3.9-dev
. Anything else is the same. and it works!