migrate l4t wheels to Python3.9

This commit is contained in:
YS 2022-03-17 17:08:15 +03:00
parent 07950170f5
commit a55e230396

View File

@ -1,8 +1,8 @@
FROM timongentzsch/l4t-ubuntu20-base:latest FROM timongentzsch/l4t-ubuntu20-base:latest
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -yqq git python3.8 python3.8-dev python3-pip build-essential curl wget cmake RUN apt-get update && apt-get install -yqq git python3.9 python3.9-dev python3-pip build-essential curl wget cmake
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN \ RUN \
EXT_PATH=~/external && \ EXT_PATH=~/external && \
@ -13,10 +13,10 @@ RUN \
PYTHON_VERSION=`python -c 'import platform;print(platform.python_version())'` && \ PYTHON_VERSION=`python -c 'import platform;print(platform.python_version())'` && \
EXT_PATH=~/external && \ EXT_PATH=~/external && \
mkdir Python-${PYTHON_VERSION} && wget -qO- https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz | tar xvz --strip-components=1 -C Python-${PYTHON_VERSION} && \ mkdir Python-${PYTHON_VERSION} && wget -qO- https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz | tar xvz --strip-components=1 -C Python-${PYTHON_VERSION} && \
mkdir -p ${EXT_PATH}/python3.8/include && mv Python-${PYTHON_VERSION}/Include/* ${EXT_PATH}/python3.8/include/ && rm -rf Python-${PYTHON_VERSION} && \ mkdir -p ${EXT_PATH}/python3.9/include && mv Python-${PYTHON_VERSION}/Include/* ${EXT_PATH}/python3.9/include/ && rm -rf Python-${PYTHON_VERSION} && \
cp /usr/include/aarch64-linux-gnu/python3.8/pyconfig.h ~/external/python3.8/include/ cp /usr/include/aarch64-linux-gnu/python3.9/pyconfig.h ~/external/python3.9/include/
RUN \ RUN \
mkdir /workspace && cd /workspace && git clone https://github.com/NVIDIA/TensorRT.git && \ mkdir /workspace && cd /workspace && git clone https://github.com/NVIDIA/TensorRT.git && \
mkdir -p /workspace/TensorRT/python/include/onnx mkdir -p /workspace/TensorRT/python/include/onnx
@ -24,10 +24,12 @@ WORKDIR /workspace/TensorRT/python
# monkeypatch the environment # monkeypatch the environment
RUN \ RUN \
cd /workspace/TensorRT/python && \ cd /workspace/TensorRT/python && \
echo "mkdir -p /wheels && pip3 wheel --wheel-dir=/wheels pycuda==2021.1\n"\ echo "update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1\n"\
"update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1\n"\
"mkdir -p /wheels && pip3 wheel --wheel-dir=/wheels pycuda==2021.1\n"\
"cp -r /usr/local/cuda-10.2/targets/aarch64-linux/include/* ./include/\n"\ "cp -r /usr/local/cuda-10.2/targets/aarch64-linux/include/* ./include/\n"\
"cp -r /usr/include/aarch64-linux-gnu/* ./include/onnx/\n"\ "cp -r /usr/include/aarch64-linux-gnu/* ./include/onnx/\n"\
"EXT_PATH=/root/external PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=8 TARGET_ARCHITECTURE=aarch64 ./build.sh\n" \ "EXT_PATH=/root/external PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=9 TARGET_ARCHITECTURE=aarch64 ./build.sh\n" \
"cp /workspace/TensorRT/python/build/dist/*.whl /wheels\n" >> ./bootstrap.sh && \ "cp /workspace/TensorRT/python/build/dist/*.whl /wheels\n" >> ./bootstrap.sh && \
chmod +x ./bootstrap.sh chmod +x ./bootstrap.sh