pip install -U mysqlclient
Hello everyone,
After successfully updating my MM3 venv install, I thought I could also keep everything else up to date. One app refuses - mysqlclient. All the rest did update.
PS: I have a full backup of the venv so no worries there :)
<CUT> (venv) [mailman@gw /opt/mailman/mm]$ pip install -U mysqlclient Requirement already satisfied: mysqlclient in ./venv/lib/python3.11/site-packages (2.1.1) Collecting mysqlclient Using cached mysqlclient-2.2.0.tar.gz (89 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 ╰─> [25 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. Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/opt/mailman/mm/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/mailman/mm/venv/lib/python3.11/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-usp5tphe/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-usp5tphe/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-usp5tphe/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup exec(code, locals()) File "<string>", line 154, in <module> File "<string>", line 48, in get_config_posix File "<string>", line 27, 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. </CUT>
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
Odhiambo Washington writes:
After successfully updating my MM3 venv install, I thought I could also keep everything else up to date. One app refuses - mysqlclient. All the rest did update.
Is this a report for our benefit, or are you asking for help? I guess I can just assume the latter, I already figured out what I can say.
(venv) [mailman@gw /opt/mailman/mm]$ pip install -U mysqlclient Requirement already satisfied: mysqlclient in ./venv/lib/python3.11/site-packages (2.1.1)
"Requirement already satisfied" means that you can keep using the existing Python 3 mysqlclient wrapper. There's no need to upgrade immediately.
Exception: Can not find valid pkg-config name. Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually [end of output]
That seems clear enough to me. I don't know much about the MySQL family, so correct me if I'm wrong. As I read the trace, there are two or maybe three MySQL versions that might provide the upstream mysqlclient, and each is expected to provide a pkg-config module which generates a C compiler environment to build code that links to the mysqlclient library. For some reason, your installation of MySQL or MariaDB doesn't provide that pkg-config module, or doesn't provide it in the usual place.
If your distro provided MySQL and separates development information into a separate mysql-dev package, maybe you just need to install that.
Steve
On Sun, Oct 22, 2023 at 5:08 PM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
Odhiambo Washington writes:
After successfully updating my MM3 venv install, I thought I could also keep everything else up to date. One app refuses - mysqlclient. All the rest did update.
Is this a report for our benefit, or are you asking for help? I guess I can just assume the latter, I already figured out what I can say.
Was asking for help :)
(venv) [mailman@gw /opt/mailman/mm]$ pip install -U mysqlclient
Requirement already satisfied: mysqlclient in ./venv/lib/python3.11/site-packages (2.1.1)
"Requirement already satisfied" means that you can keep using the existing Python 3 mysqlclient wrapper. There's no need to upgrade immediately.
When it comes to Python stuff, some of us miss a lot.
Exception: Can not find valid pkg-config name.
> Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars
manually [end of output]
That seems clear enough to me. I don't know much about the MySQL family, so correct me if I'm wrong. As I read the trace, there are two or maybe three MySQL versions that might provide the upstream mysqlclient, and each is expected to provide a pkg-config module which generates a C compiler environment to build code that links to the mysqlclient library. For some reason, your installation of MySQL or MariaDB doesn't provide that pkg-config module, or doesn't provide it in the usual place.
If your distro provided MySQL and separates development information into a separate mysql-dev package, maybe you just need to install that.
I will try to figure out why this did not work automatically. Maybe there is something I did not fix when I changed from MySQL to MariaDB a few moons ago. The response by @Wikinaut <mail@tgries.de> did help though and now my venv is fully updated:
(venv) [mailman@gw /opt/mailman/mm]$ MYSQLCLIENT_CFLAGS="-I/usr/local/include/mysql" MYSQLCLIENT_LDFLAGS="-L/usr/local/lib/mysql -lmysqlclient" pip3 install -U mysqlclient Requirement already satisfied: mysqlclient in ./venv/lib/python3.11/site-packages (2.1.1) Collecting mysqlclient Using cached mysqlclient-2.2.0.tar.gz (89 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: mysqlclient Building wheel for mysqlclient (pyproject.toml) ... done Created wheel for mysqlclient: filename=mysqlclient-2.2.0-cp311-cp311-freebsd_13_2_release_p4_amd64.whl size=78552 sha256=33cc2656b710740ba05b9eaa553b7971a38c44e4f26f572fbbd4d4e5c0bbcc02 Stored in directory: /usr/home/mailman/.cache/pip/wheels/a4/97/41/1e55ebbb29ce69d9008782f457658f48755b861fa145538ca0 Successfully built mysqlclient Installing collected packages: mysqlclient Attempting uninstall: mysqlclient Found existing installation: mysqlclient 2.1.1 Uninstalling mysqlclient-2.1.1: Successfully uninstalled mysqlclient-2.1.1 Successfully installed mysqlclient-2.2.0
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
I had the same problem two days ago!
Solution is exactly this:
sudo su mailman
(venv) MYSQLCLIENT_CFLAGS="-I/usr/include/mysql" MYSQLCLIENT_LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lmysqlclient" pip3 install mysqlclient
Source: stackoverflow.com/a/76801424/731798
On Sun, Oct 22, 2023 at 7:24 PM Wikinaut <mail@tgries.de> wrote:
I had the same problem two days ago!
Solution is exactly this:
sudo su mailman
(venv) MYSQLCLIENT_CFLAGS="-I/usr/include/mysql" MYSQLCLIENT_LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lmysqlclient" pip3 install mysqlclient
Source: stackoverflow.com/a/76801424/731798
Thanks. This worked for me, except that in FreeBSD it changes a little: MYSQLCLIENT_CFLAGS="-I/usr/local/include/mysql" MYSQLCLIENT_LDFLAGS="-L/usr/local/lib/mysql -lmysqlclient" pip3 install -U mysqlclient
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
participants (3)
-
Odhiambo Washington
-
Stephen J. Turnbull
-
Wikinaut