7878 "2024.0.0" , # Standalone OpenVINO
7979 "3.2.6" , # DCGM version
8080 "0.5.3.post1" , # vLLM version
81- "3.12" , # RHEL Python version
81+ "3.12.1 " , # RHEL Python version
8282 )
8383}
8484
@@ -926,7 +926,6 @@ def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
926926ARG TRITON_VERSION
927927ARG TRITON_CONTAINER_VERSION
928928"""
929- df += change_default_python_version_rhel (TRITON_VERSION_MAP [FLAGS .version ][7 ])
930929 df += """
931930# Install docker docker buildx
932931RUN yum install -y ca-certificates curl gnupg yum-utils \\
@@ -952,7 +951,6 @@ def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
952951 libb64-devel \\
953952 gperftools-devel \\
954953 patchelf \\
955- python3.12-devel \\
956954 python3-pip \\
957955 python3-setuptools \\
958956 rapidjson-devel \\
@@ -965,6 +963,10 @@ def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
965963 libxml2-devel \\
966964 numactl-devel \\
967965 wget
966+ """
967+ # Requires openssl-devel to be installed first for pyenv build to be successful
968+ df += change_default_python_version_rhel (TRITON_VERSION_MAP [FLAGS .version ][7 ])
969+ df += """
968970
969971RUN pip3 install --upgrade pip \\
970972 && pip3 install --upgrade \\
@@ -1392,23 +1394,25 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
13921394 # Add dependencies needed for python backend
13931395 if "python" in backends :
13941396 if target_platform () == "rhel" :
1395- df += change_default_python_version_rhel (
1396- TRITON_VERSION_MAP [FLAGS .version ][7 ]
1397- )
13981397 df += """
13991398# python3, python3-pip and some pip installs required for the python backend
14001399RUN yum install -y \\
1401- python3.12-devel \\
14021400 libarchive-devel \\
14031401 python3-pip \\
14041402 openssl-devel \\
1405- readline-devel \\
1406- && pip3 install --upgrade pip \\
1407- && pip3 install --upgrade \\
1408- wheel \\
1409- setuptools \\
1410- \" numpy<2\" \\
1411- virtualenv
1403+ readline-devel
1404+ """
1405+ # Requires openssl-devel to be installed first for pyenv build to be successful
1406+ df += change_default_python_version_rhel (
1407+ TRITON_VERSION_MAP [FLAGS .version ][7 ]
1408+ )
1409+ df += """
1410+ RUN pip3 install --upgrade pip \\
1411+ && pip3 install --upgrade \\
1412+ wheel \\
1413+ setuptools \\
1414+ \" numpy<2\" \\
1415+ virtualenv
14121416"""
14131417 else :
14141418 df += """
@@ -1537,6 +1541,8 @@ def add_cpu_libs_to_linux_dockerfile(backends, target_machine):
15371541
15381542
15391543def change_default_python_version_rhel (version ):
1544+ # Example version 3.12.1 --> 3.12
1545+ major_minor_version = "." .join (version .split ("." )[:2 ])
15401546 df = """
15411547# RHEL image has several python versions. It's important
15421548# to set the correct version, otherwise, packages that are
@@ -1548,7 +1554,21 @@ def change_default_python_version_rhel(version):
15481554ENV PYTHON_BIN_PATH ${{PYBIN}}/python${{PYVER}}
15491555ENV PATH ${{PYBIN}}:${{PATH}}
15501556""" .format (
1551- version
1557+ major_minor_version
1558+ )
1559+ df += """
1560+ # The python library version available for install via 'yum install python3.X-devel' does not
1561+ # match the version of python inside the RHEL base container. This means that python packages
1562+ # installed within the container will not be picked up by the python backend stub process pybind
1563+ # bindings. It must instead must be installed via pyenv.
1564+ RUN curl https://pyenv.run | bash \\
1565+ && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \\
1566+ && echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \\
1567+ && echo 'eval "$(pyenv init -)"' >> ~/.bashrc
1568+ && source ~/.bashrc
1569+ RUN CONFIGURE_OPTS=\" --with-openssl=/usr/lib64\" && pyenv install {} \\
1570+ && cp /root/.pyenv/versions/{}/lib/libpython3* /usr/lib64/""" .format (
1571+ version , version
15521572 )
15531573 return df
15541574
0 commit comments