From 550460f456c1eff3c002232648b1d9f7ed79fd1b Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Mon, 16 Oct 2023 16:58:45 +0800 Subject: [PATCH] add python3.12 --- tools/dockerfile/Dockerfile.centos | 7 ++- tools/dockerfile/Dockerfile.ubuntu20 | 47 +++++++++---------- tools/dockerfile/build_scripts/build_utils.sh | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/tools/dockerfile/Dockerfile.centos b/tools/dockerfile/Dockerfile.centos index d47ca703f6479..76ae8c2f2a852 100644 --- a/tools/dockerfile/Dockerfile.centos +++ b/tools/dockerfile/Dockerfile.centos @@ -53,19 +53,22 @@ RUN wget https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/python/re RUN LD_LIBRARY_PATH=/opt/_internal/cpython-3.8.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.8.0/bin/pip3 install setuptools -U && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.9.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.9.0/bin/pip3 install setuptools -U && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.10.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.10.0/bin/pip3 install setuptools -U && \ - LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.11.0/bin/pip3 install setuptools -U + LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.11.0/bin/pip3 install setuptools -U && \ + LD_LIBRARY_PATH=/opt/_internal/cpython-3.12.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.12.0/bin/pip3 install setuptools -U RUN LD_LIBRARY_PATH=/opt/_internal/cpython-3.8.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.8.0/bin/pip3 install -r /root/requirements.txt && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.9.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.9.0/bin/pip3 install -r /root/requirements.txt && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.10.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.10.0/bin/pip3 install -r /root/requirements.txt && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.11.0/bin/pip3 install -r /root/requirements.txt && \ + LD_LIBRARY_PATH=/opt/_internal/cpython-3.12.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.12.0/bin/pip3 install -r /root/requirements.txt && \ go get github.com/Masterminds/glide && \ rm -rf /root/requirements.txt RUN LD_LIBRARY_PATH=/opt/_internal/cpython-3.8.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.8.0/bin/pip3 install pre-commit 'ipython==5.3.0' && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.9.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.9.0/bin/pip3 install pre-commit 'ipython==5.3.0' && \ LD_LIBRARY_PATH=/opt/_internal/cpython-3.10.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.10.0/bin/pip3 install pre-commit 'ipython==5.3.0' && \ - LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.11.0/bin/pip3 install pre-commit 'ipython==5.3.0' + LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.11.0/bin/pip3 install pre-commit 'ipython==5.3.0' && \ + LD_LIBRARY_PATH=/opt/_internal/cpython-3.12.0/lib/:${LD_LIBRARY_PATH} /opt/_internal/cpython-3.12.0/bin/pip3 install pre-commit 'ipython==5.3.0' RUN wget -O /opt/swig-2.0.12.tar.gz --no-check-certificate https://sourceforge.net/projects/swig/files/swig/swig-2.0.12/swig-2.0.12.tar.gz/download && \ cd /opt && tar xzf swig-2.0.12.tar.gz && cd /opt/swig-2.0.12 && ./configure && make && make install && cd /opt && rm swig-2.0.12.tar.gz diff --git a/tools/dockerfile/Dockerfile.ubuntu20 b/tools/dockerfile/Dockerfile.ubuntu20 index 3fbbaf8f707af..a613f3961b5b5 100644 --- a/tools/dockerfile/Dockerfile.ubuntu20 +++ b/tools/dockerfile/Dockerfile.ubuntu20 @@ -58,11 +58,11 @@ RUN wget -q https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.tar.gz && ta ENV PATH=/home/cmake-3.18.0-Linux-x86_64/bin:$PATH RUN apt-get update && \ - apt-get install -y python3.7 python3.7-dev python3.7-distutils\ - python3.8 python3.8-dev python3.8-distutils \ + apt-get install python3.8 python3.8-dev python3.8-distutils \ python3.9 python3.9-dev python3.9-distutils \ python3.10 python3.10-dev python3.10-distutils \ python3.11 python3.11-dev python3.11-distutils && \ + python3.12 python3.12-dev python3.12-distutils && \ apt-get install python-is-python3 && \ rm /usr/bin/python && ln -s /usr/bin/python3.9 /usr/bin/python && \ rm /usr/bin/python3 && ln -s /usr/bin/python3.9 /usr/bin/python3 @@ -72,9 +72,9 @@ RUN wget https://files.pythonhosted.org/packages/a7/e0/30642b9c2df516506d40b563b WORKDIR /home/setuptools-50.3.2 RUN python3.9 setup.py build && python3.9 setup.py install && \ python3.8 setup.py build && python3.8 setup.py install && \ - python3.7 setup.py build && python3.7 setup.py install && \ python3.10 setup.py build && python3.10 setup.py install && \ - python3.11 setup.py build && python3.11 setup.py install + python3.11 setup.py build && python3.11 setup.py install && \ + python3.12 setup.py build && python3.12 setup.py install WORKDIR /home RUN wget https://files.pythonhosted.org/packages/28/af/2c76c8aa46ccdf7578b83d97a11a2d1858794d4be4a1610ade0d30182e8b/pip-20.0.1.tar.gz && tar -zxvf pip-20.0.1.tar.gz @@ -82,9 +82,9 @@ WORKDIR pip-20.0.1 RUN python3.9 setup.py install && \ python3.8 setup.py install && \ - python3.7 setup.py install && \ python3.10 setup.py install && \ - python3.11 setup.py install + python3.11 setup.py install && \ + python3.12 setup.py install WORKDIR /home RUN rm setuptools-50.3.2.zip pip-20.0.1.tar.gz && \ @@ -115,56 +115,55 @@ RUN git config --global credential.helper store RUN localedef -i en_US -f UTF-8 en_US.UTF-8 #For pre-commit -RUN python3.7 -m pip --no-cache-dir install --upgrade pip && \ - python3.8 -m pip --no-cache-dir install --upgrade pip && \ +RUN python3.8 -m pip --no-cache-dir install --upgrade pip && \ python3.9 -m pip --no-cache-dir install --upgrade pip && \ python3.10 -m pip --no-cache-dir install --upgrade pip && \ - python3.11 -m pip --no-cache-dir install --upgrade pip + python3.11 -m pip --no-cache-dir install --upgrade pip && \ + python3.12 -m pip --no-cache-dir install --upgrade pip RUN rm -f /usr/local/bin/pip && ln -s /usr/local/bin/pip3.9 /usr/local/bin/pip && \ rm -f /usr/local/bin/pip3 && ln -s /usr/local/bin/pip3.9 /usr/local/bin/pip3 -RUN pip3.7 --no-cache-dir install ipython==5.3.0 && \ - pip3.7 --no-cache-dir install ipykernel==4.6.0 wheel && \ - pip3.8 --no-cache-dir install ipython==5.3.0 && \ +RUN pip3.8 --no-cache-dir install ipython==5.3.0 && \ pip3.8 --no-cache-dir install ipykernel==4.6.0 wheel && \ pip3.9 --no-cache-dir install ipython==5.3.0 && \ pip3.9 --no-cache-dir install ipykernel==4.6.0 wheel && \ pip3.10 --no-cache-dir install ipython==5.3.0 && \ pip3.10 --no-cache-dir install ipykernel==4.6.0 wheel && \ pip3.11 --no-cache-dir install ipython==5.3.0 && \ - pip3.11 --no-cache-dir install ipykernel==4.6.0 wheel + pip3.11 --no-cache-dir install ipykernel==4.6.0 wheel && \ + pip3.12 --no-cache-dir install ipython==5.3.0 && \ + pip3.12 --no-cache-dir install ipykernel==4.6.0 wheel #For docstring checker -RUN pip3.7 --no-cache-dir install pytest astroid isort && \ - pip3.8 --no-cache-dir install pytest astroid isort && \ +RUN pip3.8 --no-cache-dir install pytest astroid isort && \ pip3.9 --no-cache-dir install pytest astroid isort && \ pip3.10 --no-cache-dir install pytest astroid isort && \ - pip3.11 --no-cache-dir install pytest astroid isort + pip3.11 --no-cache-dir install pytest astroid isort && \ + pip3.12 --no-cache-dir install pytest astroid isort -RUN pip3.7 --no-cache-dir install pre-commit==2.17.0 pylint==2.12.0 && \ - pip3.8 --no-cache-dir install pre-commit==2.17.0 pylint==2.12.0 && \ +RUN pip3.8 --no-cache-dir install pre-commit==2.17.0 pylint==2.12.0 && \ pip3.9 --no-cache-dir install pre-commit==2.17.0 pylint==2.12.0 && \ pip3.10 --no-cache-dir install pre-commit==2.17.0 pylint==2.12.0 && \ - pip3.7 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ pip3.8 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ pip3.9 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ pip3.10 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ - pip3.11 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 + pip3.11 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 && \ + pip3.12 --no-cache-dir install cpplint==1.6.0 clang-format==13.0.0 COPY ./python/requirements.txt /root/ COPY ./python/unittest_py/requirements.txt /home/ -RUN pip3.7 --no-cache-dir install -r /root/requirements.txt && \ - pip3.7 --no-cache-dir install -r /home/requirements.txt && \ - pip3.8 --no-cache-dir install -r /root/requirements.txt && \ +RUN pip3.8 --no-cache-dir install -r /root/requirements.txt && \ pip3.8 --no-cache-dir install -r /home/requirements.txt && \ pip3.9 --no-cache-dir install -r /root/requirements.txt && \ pip3.9 --no-cache-dir install -r /home/requirements.txt && \ pip3.10 --no-cache-dir install -r /root/requirements.txt && \ pip3.10 --no-cache-dir install -r /home/requirements.txt && \ pip3.11 --no-cache-dir install -r /root/requirements.txt && \ - pip3.11 --no-cache-dir install -r /home/requirements.txt + pip3.11 --no-cache-dir install -r /home/requirements.txt && \ + pip3.12 --no-cache-dir install -r /root/requirements.txt && \ + pip3.12 --no-cache-dir install -r /home/requirements.txt # ccache 4.2.0 diff --git a/tools/dockerfile/build_scripts/build_utils.sh b/tools/dockerfile/build_scripts/build_utils.sh index 43167f41057dd..d27467afffbfe 100755 --- a/tools/dockerfile/build_scripts/build_utils.sh +++ b/tools/dockerfile/build_scripts/build_utils.sh @@ -104,7 +104,7 @@ function do_cpython_build { LD_LIBRARY_PATH="/usr/local/ssl/lib:${prefix}/lib" ${prefix}/bin/python -m pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/ fi LD_LIBRARY_PATH="/usr/local/ssl/lib:${prefix}/lib" ${prefix}/bin/python get-pip.py - LD_LIBRARY_PATH="/usr/local/ssl/lib:${prefix}/lib" ${prefix}/bin/pip install wheel==0.32.2 + LD_LIBRARY_PATH="/usr/local/ssl/lib:${prefix}/lib" ${prefix}/bin/pip install wheel==0.40.0 cd / ls ${MY_DIR} local abi_tag=$(LD_LIBRARY_PATH="${prefix}/lib" ${prefix}/bin/python ${MY_DIR}/python-tag-abi-tag.py)