Question

ERROR: Failed building wheel for mysqlclient blocker on Unbuntu 18.04 droplet

Hi, I’m running into this blocking issue while setting up Django with MySQL database. I’m pasting here what I tried so far on Ubuntu 18.04 droplet.

$ sudo apt install nginx mysql-server python3-pip python3-dev libmysqlclient-dev 
$ sudo apt install mysql-client
$ sudo mysql_secure_installation
$ sudo mysql ( configured new db requirements )
$ sudo -H pip3 install --upgrade pip
$ sudo -H pip3 install virtualenv
$ pip install django gunicorn mysqlclient (virtualenv) 

This is where mysqlclient was not getting installed. Here is the error snippet.

(vkdev)user@ubuntu-hejjjj:~/testproject$ pip install mysqlclient
Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
.......   
.......
  /usr/bin/ld: cannot find -lssl
  /usr/bin/ld: cannot find -lcrypto
  collect2: error: ld returned 1 exit status
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:

Since mysqlclient install is failed here, I continued to try these steps but I don’t have luck so far.

$ pip install django gunicorn (virtualenv)
$ sudo apt install python3-dev libmysqlclient-dev
$ sudo apt-get install python3-pymysql
$ sudo apt-get install python3.6-dev
$ sudo apt-get install python3.7-dev libmysqlclient-dev gcc default-libmysqlclient-dev

I appreciate if someone has a clue with appropriate steps.

Thanks


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I solved the problem installing libssl-dev

sudo apt-get install libssl-dev

Reference: Unable to install mysqlclient using pip (Ubuntu 18.04 LTS)

I have the same problem

How come I don’t answer for anyone? Does Digital Ocean provide minimum customer support at least through this channel?