Установка mysqlclient с помощью pip завершается с ошибкой «выход из подпроцесса с ошибкой»Python

Программы на Python
Ответить
Anonymous
 Установка mysqlclient с помощью pip завершается с ошибкой «выход из подпроцесса с ошибкой»

Сообщение Anonymous »

Я использую Linux Mint 22 и столкнулся с проблемой при попытке установить mysqlclient с помощью pip. При установке происходит сбой и возвращается ошибка «subprocess-exited-with-error».
Ниже приведен вывод консоли:
(env) sh-5.2$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.2.6.tar.gz (91 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
Trying pkg-config --exists mysqlclient
Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
Trying pkg-config --exists mariadb
Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
Trying pkg-config --exists libmariadb
Command 'pkg-config --exists libmariadb' returned non-zero exit status 1.
Trying pkg-config --exists perconaserverclient
Command 'pkg-config --exists perconaserverclient' returned non-zero exit status 1.
Traceback (most recent call last):
File "/home/usr/School/24-25/P2/project en samenwerken/Project/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/home/usr/School/24-25/P2/project en samenwerken/Project/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/usr/School/24-25/P2/project en samenwerken/Project/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-2g4_q5k5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-2g4_q5k5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-2g4_q5k5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
exec(code, locals())
File "", line 155, in
File "", line 49, in get_config_posix
File "", line 28, in find_package_name
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
(env) sh-5.2$

Я последовал совету из других сообщений и установил необходимые зависимости с помощью следующей команды:
usr@usr-laptop:~$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config mysql-server libffi-dev libssl-dev libmysqlclient-dev

вывод подтверждает, что все пакеты уже установлены:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-dev is already the newest version (3.12.3-0ubuntu2).
default-libmysqlclient-dev is already the newest version (1.1.0build1).
build-essential is already the newest version (12.10ubuntu1).
pkg-config is already the newest version (1.8.1-2build1).
mysql-server is already the newest version (8.0.40-0ubuntu0.24.04.1).
libffi-dev is already the newest version (3.4.6-1build1).
libssl-dev is already the newest version (3.0.13-0ubuntu3.4).
libmysqlclient-dev is already the newest version (8.0.40-0ubuntu0.24.04.1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Даже после установки всех зависимостей установка по-прежнему завершается с ошибкой. Проблема не в pip, я могу нормально установить другие пакеты.
Решение в Mysqlclient не может быть установлено через pip, не может найти имя pkg-config в Ubuntu, у меня это не работает . Решение этого вопроса не решает его, поскольку я уже установил пакеты
pkg-config python3-dev default-libmysqlclient-dev build-essential


Подробнее здесь: https://stackoverflow.com/questions/792 ... with-error
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»