ERROR: No matching distribution found for mysqlclient

created at 01-25-2022 views: 60


error when installing mysqlcliend with pip3

  ERROR: Command errored out with exit status 1:
   command: /usr/local/python3/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/'"'"'; __file__='"'"'/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code ='"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-d9esx5w9
       cwd: /tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/
  Complete output (10 lines):
  /bin/sh: mysql_config: command not found
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/", line 17, in <module>
      metadata, options = get_config()
    File "/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/", line 47, in get_config
      libs = mysql_config("libs_r")
    File "/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/", line 29, in mysql_config
      raise EnvironmentError("%s not found" % (mysql_config.path,))
  OSError: mysql_config not found
WARNING: Discarding (from Command errored out with exit status 1: python egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0rc1, 2.1.0)
ERROR: No matching distribution found for mysqlclient


try to install these dependencies:

yum install -y mysql-devel gcc gcc-devel python-devel

in my case, it is the mysql-devel that was missed


[root@localhost ~]# yum install -y mysql-devel gcc gcc-devel python-devel
Transaction test succeeded
Running transaction
  Installing : mysql-community-devel-8.0.28-1.el7.x86_64                                                                                                               1/1 
  Verifying  : mysql-community-devel-8.0.28-1.el7.x86_64                                                                                                               1/1 

  mysql-community-devel.x86_64 0:8.0.28-1.el7                                                                                                                              


then you can install mysqlclient

pip3 install mysqlclient


The mysqlclient installation failed because of the lack of some dependencies. Try to install the following dependencies in sequence:

sudo apt install -y mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt install libssl-dev
sudo apt install libcrypto++-dev

Finally, install the mysqlclient version you need to install:

pip install mysqlclient
created at:01-25-2022
edited at: 01-25-2022: