ERROR: No matching distribution found for mysqlclient

created at 01-25-2022 views: 60

probelm

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/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\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/setup.py", line 17, in <module>
      metadata, options = get_config()
    File "/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/setup_posix.py", line 47, in get_config
      libs = mysql_config("libs_r")
    File "/tmp/pip-install-wn7yx2sr/mysqlclient_fa6dcb6e6e6647109c21fbd2a1c8e137/setup_posix.py", line 29, in mysql_config
      raise EnvironmentError("%s not found" % (mysql_config.path,))
  OSError: mysql_config not found
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6a/91/bdfe808fb5dc99a5f65833b370818161b77ef6d1e19b488e4c146ab615aa/mysqlclient-1.3.0.tar.gz#sha256=06eb5664e3738b283ea2262ee60ed83192e898f019cc7ff251f4d05a564ab3b7 (from https://pypi.org/simple/mysqlclient/). Command errored out with exit status 1: python setup.py 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

CentOS

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

return:

[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 

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

Complete!

then you can install mysqlclient

pip3 install mysqlclient

ubuntu

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: