Issue
During cPanel update (upcp), you may encounter errors like:
/usr/bin/python3.12 is needed by cpanel-xxxx
Error: Unable to find a match: python312
This happens because Python 3.12 is not available in default RHEL/CloudLinux repositories.
Cause
-
cPanel newer builds depend on Python 3.12
-
RHEL-based systems (AlmaLinux, CloudLinux, RockyLinux) may not include it by default
-
dnf/yum install python312fails
Solution Overview
We will:
-
Compile Python 3.12 from source
-
Create a dummy RPM package to satisfy cPanel dependency
-
Map
/usr/bin/python3.12to compiled binary
Step 1: Install Required Build Tools
yum groupinstall "Development Tools" -y
yum install gcc openssl-devel bzip2-devel libffi-devel wget -y
Step 2: Compile Python 3.12 from Source
cd /usr/src
wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz
tar xzf Python-3.12.3.tgz
cd Python-3.12.3
./configure --enable-optimizations
make -j$(nproc)
make altinstall
Verify:
/usr/local/bin/python3.12 -V
Step 3: Install RPM Build Tools
dnf install rpm-build -y
Step 4: Prepare RPM Build Environment
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
Step 5: Create Dummy RPM Spec File
nano ~/rpmbuild/SPECS/python312.spec
Paste:
Name: python312
Version: 3.12
Release: 1
Summary: Python 3.12 provider
License: GPL
BuildArch: noarch
%description
Provides /usr/bin/python3.12 for cPanel dependency.
%install
mkdir -p %{buildroot}/usr/bin
cat << 'EOF' > %{buildroot}/usr/bin/python3.12
#!/bin/bash
exec /usr/local/bin/python3.12 "$@"
EOF
chmod +x %{buildroot}/usr/bin/python3.12
%files
/usr/bin/python3.12
Step 6: Build RPM
rpmbuild -bb ~/rpmbuild/SPECS/python312.spec
Step 7: Install Dummy Package
rpm -ivh ~/rpmbuild/RPMS/noarch/python312-3.12-1.noarch.rpm
Step 8: Verify Installation
which python3.12
python3.12 -V
rpm -qf /usr/bin/python3.12
Step 9: Run cPanel Update Again
/scripts/upcp --force
Rollback (If Needed)
To remove dummy package:
rpm -e python312-3.12-1.noarch
Important Notes
-
make altinstallis used to avoid breaking system Python -
Do NOT replace
/usr/bin/python3 -
This method safely satisfies cPanel dependency without affecting OS stability
-
Dummy RPM only provides a wrapper, not actual Python binaries
Best Practice Recommendation
-
Always check if Python 3.12 is available via:
-
CloudLinux repos
-
AppStream modules
-
-
Use source build only when absolutely necessary
