pip install mysqlclient mysql_config: not found

On Ubuntu 18.04, when i install mysqlclient python module, i get error

(venv) boby@sok-01:~/Downloads/django-deploy$ pip install mysqlclient==1.4.2.post1
Collecting mysqlclient==1.4.2.post1
  Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-install-we5rsid9/mysqlclient/setup.py", line 16, in 
        metadata, options = get_config()
      File "/tmp/pip-install-we5rsid9/mysqlclient/setup_posix.py", line 51, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-we5rsid9/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-we5rsid9/mysqlclient/
WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) boby@sok-01:~/Downloads/django-deploy$

this is fixed by installing libmysqlclient-dev

apt install libmysqlclient-dev
  • ERROR: Failed building wheel for mysqlclient
  • See Python

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *