SOLVED Error when trying to pip install mysqlclient

Operating System & Version
x86_64, linux, kernel version 3.10.0-962.3.2.lve1.5.63.el7.x86_64
cPanel & WHM Version
cPanel 94.0 (build 24)

Fabius

Member
May 11, 2022
9
3
3
UK
cPanel Access Level
Website Owner
I'm trying to set up a Python application using the cPanel interface. I've successfully created it and added the requirements.txt file.

But when I click the "Run Pip Install" button, and select "requirements.txt", after it spins for a while I get this error message:

error: subprocess-exited-with-error
× python setup.py bdist_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.
ERROR: Failed building wheel for mysqlclient
error: subprocess-exited-with-error

× Running setup.py install for mysqlclient 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.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mysqlclientnote: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
The requirements.txt file lists
Code:
mysqlclient==2.1.0
and my Python app is set to use python 3.8.6.

How can I complete the installation?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,361
1,632
363
cPanel Access Level
Root Administrator
Hey there! cPanel doesn't officially provide support for Python tools as outlined in our notice at the tope of this documentation page:


but have you tried making sure the mysql-community-devel or mysql-devel package is installed? If that is missing, Pip may not be able to build the mysqlclient properly.

This seems to be a relatively recent error as most information I found about this issue was created within the last 6 months. Here is one example:

 
  • Like
Reactions: Fabius

Fabius

Member
May 11, 2022
9
3
3
UK
cPanel Access Level
Website Owner
Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.

A shame the former didn't work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?
 

Spirogg

Well-Known Member
Feb 21, 2018
698
153
43
chicago
cPanel Access Level
Root Administrator
Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.

A shame the former didn't work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?
Depends on OS but yum should work for AlmaLinux as well or you can use
dnf install [pkg-name]
yum install [pkg-name]

yum install mysql-devel
yum install mysql-community-devel

or

dnf install mysql-devel
dnf install mysql-community-devel


[[email protected] ~]# yum install mysql-community-devel
Last metadata expiration check: 1:53:02 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]# ]yum install mysql-devel
bash: ]yum: command not found
[[email protected] ~]# yum install mysql-devel
Last metadata expiration check: 1:54:11 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]
 

Fabius

Member
May 11, 2022
9
3
3
UK
cPanel Access Level
Website Owner
Thank you! I'm a bit wary of installing extra stuff like this, given I'm setting this site up on someone else's server for them. But it's useful to know what to do if mysql-connector-python doesn't work out (or for anyone else finding this page and wondering what to do!).
 
  • Like
Reactions: cPRex and Spirogg