Failed building wheel for mysqlclient error

mismari

Registered
Apr 16, 2019
3
0
1
Iran
cPanel Access Level
Root Administrator
Hello
I use Python
I have enabled Linux in the Cpanel
The problem is with the Python database
Gives the following error
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
And also gives another error in connection with sqlite that seems to be not active on the server
Failed building wheel for mysqlclient
Please help me how to enable it for Python / Launch Django app / in Cpanel
Thanks
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,902
2,227
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @mismari,

Can you share some more information about how you are setting up Django? Do you have root access to the server, or is this a cPanel account hosted with a shared hosting provider?

If you have root access, can you confirm if you are using the Python Selector feature with CloudLinux? Or, did you install the experimental ea-apache24-mod_wsgi RPM offered with EasyApache 4?

Thank you.
 

mismari

Registered
Apr 16, 2019
3
0
1
Iran
cPanel Access Level
Root Administrator
Hello @mismari,

Can you share some more information about how you are setting up Django? Do you have root access to the server, or is this a cPanel account hosted with a shared hosting provider?

If you have root access, can you confirm if you are using the Python Selector feature with CloudLinux? Or, did you install the experimental ea-apache24-mod_wsgi RPM offered with EasyApache 4?

Thank you.
Hello
Yes . I have access to my root
Yes I enabled Python using CloudLinux and have access to my Python selections.
Yes I installed and activated the mod_wsgi module in Apache
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,902
2,227
363
cPanel Access Level
DataCenter Provider
Twitter
Yes I enabled Python using CloudLinux and have access to my Python selections.
Hello @mismari,

Here's a summary of a response by a CloudLinux Technical Support Engineer after investigating a similar issue in a support ticket:

First, I disabled shell fork bomb protection via WHM >> Shell Fork Bomb Protection. Then, I enabled compilers and forced a cagefs filesystem update by executing the following command as root:

# /scripts/compilers on && cagefsctl --force-update

After this, the extension was added successfully by executing the following command as root:

# selectorctl --interpreter=python --user=username123 --enable-user-extensions=mysqlclient main

Replace "username123" with the username of the cPanel account.
Can you let me know if this answer helps?

Thank you.
 

mismari

Registered
Apr 16, 2019
3
0
1
Iran
cPanel Access Level
Root Administrator
Hello @mismari,

Here's a summary of a response by a CloudLinux Technical Support Engineer after investigating a similar issue in a support ticket:



Can you let me know if this answer helps?

Thank you.

Hello
I disabled the shell for the relevant user
By tapping the following command
selectorctl --interpreter = python --user = username123 --enable-user-extensions = mysqlclient main
But an error is received
ERROR: No such application (or application not configured) "main"
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,902
2,227
363
cPanel Access Level
DataCenter Provider
Twitter
I disabled the shell for the relevant user
Hello @mismari,

The CloudLinux response is advising the user to browse to disable WHM >> Shell Fork Bomb Protection rather than disabling SSH access on the account.

selectorctl --interpreter = python --user = username123 --enable-user-extensions = mysqlclient main
CloudLinux documents how to use selectorctl on the following link:

Command Line

Here's the part of the document relevant to the task you're performing:

To install modules to application environment:

/usr/bin/selectorctl --interpreter=python [--user=USER] [--print-summary] [--json] --enable-user-extensions=<module1[,module2...]> <FOLDER_NAME>
Thus, the command would look like this:

Code:
selectorctl --interpreter=python --user=$username123 --enable-user-extensions=mysqlclient $folder-name
Replace "$username123" with the username of the cPanel account and replace $folder-name with the name of the folder where your Python application is stored.

Thank you.