Quiero instalar una biblioteca en mi entorno virtual en Fedora para connectarme a MySQL:
(venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
Using cached mysqlclient-1.3.7.tar.gz (79 kB)
ERROR: Command errored out with exit status 1:
command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/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-dt7pv4kk
cwd: /tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/
Complete output (10 lines):
/bin/sh: line 1: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/74/ff/4e964e20b559e55d7afa60fbccc6a560f2adf289813bd3d7eb4eb8a87093/mysqlclient-1.3.7.tar.gz#sha256=c74a83b4cb2933d0e43370117eeebdfa03077ae72686d2df43d31879267f1f1b (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==1.3.7 (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)
ERROR: No matching distribution found for mysqlclient==1.3.7
No sé qué error ha provocado éste, si es el hecho de no encontrar la librería mysqlclient==1.3.7
o si es OSError: mysql_confignot found
...
yum install python3-devel mysql-devel
(venv) [ac@localmachine data-tools]$ sudo yum install python3-devel mysql-devel
[sudo] password for ac:
Fedora 34 - x86_64 - Updates 54 kB/s | 24 kB 00:00
Fedora 34 - x86_64 - Updates 1.1 MB/s | 2.4 MB 00:02
Fedora Modular 34 - x86_64 - Updates 36 kB/s | 24 kB 00:00
Package python3-devel-3.9.5-2.fc34.x86_64 is already installed.
Error:
Problem: problem with installed package community-mysql-devel-8.0.25-1.fc34.x86_64
- package community-mysql-devel-8.0.25-1.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.9-5.fc34.i686
- package mariadb-devel-3:10.5.9-5.fc34.i686 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.25-1.fc34.x86_64
- package community-mysql-devel-8.0.23-2.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.9-5.fc34.i686
- package mariadb-devel-3:10.5.9-5.fc34.i686 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.23-2.fc34.x86_64
- conflicting requests
- package community-mysql-devel-8.0.25-1.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.11-1.fc34.i686
- package mariadb-devel-3:10.5.11-1.fc34.i686 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.25-1.fc34.x86_64
- package community-mysql-devel-8.0.23-2.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.11-1.fc34.i686
- package mariadb-devel-3:10.5.11-1.fc34.i686 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.23-2.fc34.x86_64
- package community-mysql-devel-8.0.25-1.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.9-5.fc34.x86_64
- package mariadb-devel-3:10.5.9-5.fc34.x86_64 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.25-1.fc34.x86_64
- package community-mysql-devel-8.0.23-2.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.9-5.fc34.x86_64
- package mariadb-devel-3:10.5.9-5.fc34.x86_64 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.23-2.fc34.x86_64
- package community-mysql-devel-8.0.25-1.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.11-1.fc34.x86_64
- package mariadb-devel-3:10.5.11-1.fc34.x86_64 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.25-1.fc34.x86_64
- package community-mysql-devel-8.0.23-2.fc34.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.5.11-1.fc34.x86_64
- package mariadb-devel-3:10.5.11-1.fc34.x86_64 conflicts with community-mysql-devel provided by community-mysql-devel-8.0.23-2.fc34.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)
(venv) [ac@localmachine data-tools]$ sudo yum install python3-devel mysql-devel --allowerasing
Last metadata expiration check: 0:00:43 ago on Mon 05 Jul 2021 10:15:01 AM CEST.
Package python3-devel-3.9.5-2.fc34.x86_64 is already installed.
Dependencies resolved.
===============================================================================================================================================================================
Package Architecture Version Repository Size
===============================================================================================================================================================================
Installing:
mariadb-devel x86_64 3:10.5.11-1.fc34 updates 1.0 M
Installing dependencies:
mariadb-connector-c-devel x86_64 3.1.13-1.fc34 updates 55 k
Removing dependent packages:
community-mysql-devel x86_64 8.0.25-1.fc34 @updates 364 k
Transaction Summary
===============================================================================================================================================================================
Install 2 Packages
Remove 1 Package
Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): mariadb-connector-c-devel-3.1.13-1.fc34.x86_64.rpm 488 kB/s | 55 kB 00:00
(2/2): mariadb-devel-10.5.11-1.fc34.x86_64.rpm 2.2 MB/s | 1.0 MB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 831 kB/s | 1.0 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mariadb-connector-c-devel-3.1.13-1.fc34.x86_64 1/3
Installing : mariadb-devel-3:10.5.11-1.fc34.x86_64 2/3
Erasing : community-mysql-devel-8.0.25-1.fc34.x86_64 3/3
Running scriptlet: community-mysql-devel-8.0.25-1.fc34.x86_64 3/3
Verifying : mariadb-connector-c-devel-3.1.13-1.fc34.x86_64 1/3
Verifying : mariadb-devel-3:10.5.11-1.fc34.x86_64 2/3
Verifying : community-mysql-devel-8.0.25-1.fc34.x86_64 3/3
Installed:
mariadb-connector-c-devel-3.1.13-1.fc34.x86_64 mariadb-devel-3:10.5.11-1.fc34.x86_64
Removed:
community-mysql-devel-8.0.25-1.fc34.x86_64
Complete!
Aviso
mi experiencia con mysqlclient es un verdadero desastre:
Con Fedora:
- Con la libreria mysqlclient==1.3.7 (celle du serveur Debian):
mysql_config
falta, incluso al reinstalar conectores comomariadb-connector-c-devel
ocommunity-mysql-devel
[esta pregunta] - Con la libreria 2.0.3: MySQL-python falta, o no se reconoce
Con Windows:
- Con la librairia
mysqlclient==1.3.7
, imposible de instalar: me dice que use Visual C++ pero no cambia nada. Así que he probado con una versión preconstruida del sitio de Christoph Gohlke pero no es compatible. - Con >2.* obtengo:
OperationalError: (2006, '')
en una gran parte de las consultas SQL como la siguiente:
c.execute("""
UPDATE `{table_name}`
SET `{column_name}` = CONCAT('hash_', {expression})
WHERE {pk_name} IN ({ids})
""".format(
table_name=table_name, column_name=column_name, expression=expression, pk_name=pk_name,
ids=','.join(ids)
))
yum install python3-devel mysql-devel
. Ya los tienes?