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.