S
S
Sergey Eremin2020-04-26 17:27:34
MySQL
Sergey Eremin, 2020-04-26 17:27:34

How to install mysqlclient for MySQL 8.0.19 and Python 3.8.2 under Debian 10?

The MySQL connector for Python 3.8 is not installed. I do the following:

In Debian 10 (kernel 4.19.98-1) I added a turnip:

deb http://ftp.de.debian.org/debian testing main

Then I downloaded the MySQL package manager, configured it for MySQL 8.0.19, etc.:

wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
sudo apt-get update --fix-missing
sudo apt-get install mysql-server
MySQL got up and everything that needs to be configured in it (including the configuration file). Next, I install Python 3.8 and so on:
sudo apt-get install python3.8 python3.8-dev python3-pip python3-venv
Everything is up and everything works ... I create an environment:
python3.8 -m venv env
source env/bin/activate
python -V
pip -V
All OK. I successfully rolled up the necessary packages, but mysqlclient is not installed: It gives the

pip3 install mysqlclient

following:
Collecting mysqlclient
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/e-serg/favicon_prj/env/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ia8oy4f5/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ia8oy4f5/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-ia8oy4f5/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-ia8oy4f5/mysqlclient/
    Complete output (12 lines):
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ia8oy4f5/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-ia8oy4f5/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-ia8oy4f5/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.


What am I doing wrong? Why can't it find MySQL configs? I checked, they are in standard places and nothing unusual was found in them (although MySQL 8.0 has all sorts of new natations regarding ssl keys for the client ... but they should not interfere with the connector).

PS Under Windwos everything worked. I found a ready-made .whl for my combination of system + python + db ... But for Debian everything was always installed without crutches (just recently everything was the same with Python 3.7 and mariadb ... But now it didn’t work!

PPS Tips to use other versions of Python and madiadb are not accepted. You need exactly this combination ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-04-26
@Sergei_Erjemin

So, where is apt for mysqlclient itself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question