How to install Python 3.14 in Rocky 9 docker image

I’m trying to install Python 3.14 with Rocky 9.3 Docker image as the base. I found these instructions to do it interactively, with no system dependencies ( eg dev packages ) specified , so I’ll have to guess at those.

cd /tmp/
wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz
tar xzf Python-3.14.0.tgz
cd Python-3.14.0

sudo ./configure --prefix=/opt/python/3.14.0/ --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi --with-openssl=/usr/local/ssl
sudo make -j "$(grep -c ^processor /proc/cpuinfo)"
sudo make altinstall
sudo rm /tmp/Python-3.14.0.tgz

I converted them to docker RUN commands for my dockerfile

WORKDIR /tmp/

RUN wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz

RUN tar xzf Python-3.14.0.tgz

WORKDIR /tmp/Python-3.14.0

RUN ./configure --prefix=/opt/python/3.14.0/ --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi --with-openssl=/usr/local/ssl

RUN make -j "$(grep -c ^processor /proc/cpuinfo)"

RUN make altinstall

I’m not sure if any of this works, so I’m curious if any other users have needed to install python newer than 3.12, and how they did i

Thanks

In the build part, not sure why you are building as root, and I’d be surprised if openssl resides in /usr/local.

In the make install part (altinstall), running as root, be very careful to know exactly which files it’s going to install, and to where.