title: Unable to install mysqlclient using pip (Ubuntu 18.04 LTS)
body: <p>While installing mysqlclient using <code>pip3 install mysqlclient</code> I am geting an error "Failed building wheel for mysqlclient".
  I tried using <code>sudo apt-get install python3.6-dev libmysqlclient-dev</code> but didn't work. I am using ubuntu 18.04.2 LTS and python 3.6.8. I was trying to install the mysqlclient in a virtual env.
  The mysql server is working fine. I used the same method to install on a local windows machine and it worked fine but i can seem to make it work on server. Any ideas on why this happening. Any suggestions will be appreciated.</p>
  
  <p>Error</p>
  
  <pre><code>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:
     command: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-345d65je --python-tag cp36
         cwd: /tmp/pip-install-cl9xqcgy/mysqlclient/
    Complete output (31 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/__init__.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/_exceptions.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/compat.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/connections.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/converters.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/cursors.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/release.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    copying MySQLdb/times.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
    creating build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/CR.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/ER.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
    running build_ext
    building 'MySQLdb._mysql' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/MySQLdb
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python3.6m -I/home/abhishek/Django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
    /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:
       command: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m81sgzux/install-record.txt --single-version-externally-managed --compile --install-headers /home/abhishek/Django/include/site/python3.6/mysqlclient
           cwd: /tmp/pip-install-cl9xqcgy/mysqlclient/
      Complete output (31 lines):
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/__init__.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/_exceptions.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/compat.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/connections.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/converters.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/cursors.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/release.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      copying MySQLdb/times.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb
      creating build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/__init__.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/CLIENT.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/CR.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/ER.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/FIELD_TYPE.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/FLAG.py -&gt; build/lib.linux-x86_64-3.6/MySQLdb/constants
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/MySQLdb
      x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python3.6m -I/home/abhishek/Django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
      x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
      /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: Command errored out with exit status 1: /home/abhishek/Django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cl9xqcgy/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m81sgzux/install-record.txt --single-version-externally-managed --compile --install-headers /home/abhishek/Django/include/site/python3.6/mysqlclient Check the logs for full command output.
  
  </code></pre>