5

I want to install MySQL on my Ubuntu 20.10 desktop, but I'm facing issues. I tried installing python3-dev and libmysqlclient-dev.

When running:

pip3 install mysqlclient

I keep getting the error below:

pip3 install mysqlclient error

How may I solve this?

1
  • @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. Mar 5 at 19:12
5

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

3

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

1
  • It works for Ubuntu 18.04 too.
    – Mai Hai
    Sep 22 at 3:29
2

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.

0

If you are having trouble while setting up virtual environment then do mention python version:

sudo apt-get install python3.5-dev

sudo apt-get install mysql-client 

sudo apt-get install libmysqlclient-dev 

sudo apt-get install libssl-dev 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.