Symptoms
When a user on Python 3.8 tries to install mysqlclient, they may see these errors:
/opt/rh/devtoolset-7/root/usr/bin/gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(2,0,2,'final',0) -D__version__=2.0.2 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python38/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o
unable to execute '/opt/rh/devtoolset-7/root/usr/bin/gcc': No such file or directory
error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed with exit status 1
Description
This is an issue that has been reported to CloudLinux. They are working to resolve it. The case ID in their system is ALTPYTH-279. Follow their blog at blog.cloudlinux.com for updates.
Workaround
Run the following command as root to ensure you have the needed packages:
yum -y install alt-python38-MySQL*
Switch to SSH as the cPanel user and run these commands, replacing username and the path to your application as needed:
mv -vi /home/username/virtualenv/public_html/myapplication/3.8{,.bak}
/bin/virtualenv --prompt '(app:3.8)' --python /opt/alt/python38/bin/python3 --system-site-packages /home/username/virtualenv/public_html/myapplication/3.8/
source /home/username/virtualenv/public_html/myapplication/3.8/bin/activate && cd /home/username/virtualenv/public_html/myapplication/3.8/
pip install --upgrade pip
pip install mysqlclient
pip list