提交 e8a8f262 编写于 作者: M minqiyang

Add Python3.6 and Python3.7 support in Ubuntu Dockerfile

test=develop
上级 a5ddd827
...@@ -22,6 +22,27 @@ ENV HOME /root ...@@ -22,6 +22,27 @@ ENV HOME /root
# Add bash enhancements # Add bash enhancements
COPY ./paddle/scripts/docker/root/ /root/ COPY ./paddle/scripts/docker/root/ /root/
# Prepare packages for Python
RUN apt-get update && \
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
# Install Python3.6
RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \
tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \
./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \
wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \
CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.6 --enable-shared > /dev/null && \
make -j8 > /dev/null && make altinstall > /dev/null
# Install Python3.7
RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \
tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \
CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.7 --enable-shared > /dev/null && \
make -j8 > /dev/null && make altinstall > /dev/null
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --allow-downgrades patchelf \ apt-get install -y --allow-downgrades patchelf \
python3 python3-dev python3-pip \ python3 python3-dev python3-pip \
...@@ -34,88 +55,103 @@ RUN apt-get update && \ ...@@ -34,88 +55,103 @@ RUN apt-get update && \
liblapack-dev liblapacke-dev \ liblapack-dev liblapacke-dev \
clang-3.8 llvm-3.8 libclang-3.8-dev \ clang-3.8 llvm-3.8 libclang-3.8-dev \
build-essential checkinstall \ build-essential checkinstall \
libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \ libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \
net-tools libtool ccache && \ net-tools libtool ccache && \
apt-get clean -y apt-get clean -y
COPY tools/manylinux1/build_scripts/* /root/python/ # Install Go and glide
RUN cd /root/python/ && source build_utils && MY_DIR=/root/python/ build_cpythons 3.6.0 3.7.0 RUN wget -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
# # Install Go and glide mkdir /root/gopath && \
# RUN wget -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \ mkdir /root/gopath/bin && \
# tar -xz -C /usr/local && \ mkdir /root/gopath/src
# mkdir /root/gopath && \ ENV GOROOT=/usr/local/go GOPATH=/root/gopath
# mkdir /root/gopath/bin && \ # should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
# mkdir /root/gopath/src ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
# ENV GOROOT=/usr/local/go GOPATH=/root/gopath # install glide
# # should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. RUN curl -s -q https://glide.sh/get | sh
# ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
# # install glide # Install TensorRT
# RUN curl -s -q https://glide.sh/get | sh # following TensorRT.tar.gz is not the default official one, we do two miny changes:
# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now,
# # Install TensorRT # and its size is only one-third of the official one.
# # following TensorRT.tar.gz is not the default official one, we do two miny changes: # 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle.
# # 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details.
# # and its size is only one-third of the official one. RUN wget -qO- http://paddlepaddledeps.cdn.bcebos.com/TensorRT-4.0.0.3.Ubuntu-16.04.4.x86_64-gnu.cuda-8.0.cudnn7.0.tar.gz | \
# # 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. tar -xz -C /usr/local && \
# # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. cp -rf /usr/local/TensorRT/include /usr && \
# RUN wget -qO- http://paddlepaddledeps.cdn.bcebos.com/TensorRT-4.0.0.3.Ubuntu-16.04.4.x86_64-gnu.cuda-8.0.cudnn7.0.tar.gz | \ cp -rf /usr/local/TensorRT/lib /usr
# tar -xz -C /usr/local && \
# cp -rf /usr/local/TensorRT/include /usr && \ # git credential to skip password typing
# cp -rf /usr/local/TensorRT/lib /usr RUN git config --global credential.helper store
# # git credential to skip password typing # Fix locales to en_US.UTF-8
# RUN git config --global credential.helper store RUN localedef -i en_US -f UTF-8 en_US.UTF-8
# # Fix locales to en_US.UTF-8 # FIXME: due to temporary ipykernel dependency issue, specify ipykernel jupyter
# RUN localedef -i en_US -f UTF-8 en_US.UTF-8 # version util jupyter fixes this issue.
# # FIXME: due to temporary ipykernel dependency issue, specify ipykernel jupyter # specify sphinx version as 1.5.6 and remove -U option for [pip install -U
# # version util jupyter fixes this issue. # sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
# version(1.7.1 for now), which causes building documentation failed.
# # specify sphinx version as 1.5.6 and remove -U option for [pip install -U RUN pip3.5 install -U wheel && \
# # sphinx-rtd-theme] since -U option will cause sphinx being updated to newest pip3.5 install -U docopt PyYAML sphinx==1.5.6 && \
# # version(1.7.1 for now), which causes building documentation failed. pip3.5 install sphinx-rtd-theme==0.1.9 recommonmark && \
# RUN pip3 install -U wheel && \ pip3.6 install -U wheel && \
# pip3 install -U docopt PyYAML sphinx==1.5.6 && \ pip3.6 install -U docopt PyYAML sphinx==1.5.6 && \
# pip3 install sphinx-rtd-theme==0.1.9 recommonmark && \ pip3.6 install sphinx-rtd-theme==0.1.9 recommonmark && \
# easy_install -U pip && \ pip3.7 install -U wheel && \
# pip install -U pip setuptools wheel && \ pip3.7 install -U docopt PyYAML sphinx==1.5.6 && \
# pip install -U docopt PyYAML sphinx==1.5.6 && \ pip3.7 install sphinx-rtd-theme==0.1.9 recommonmark && \
# pip install sphinx-rtd-theme==0.1.9 recommonmark easy_install -U pip && \
pip install -U pip setuptools wheel && \
# RUN pip3 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \ pip install -U docopt PyYAML sphinx==1.5.6 && \
# pip3 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \ pip install sphinx-rtd-theme==0.1.9 recommonmark
# pip3 install opencv-python && \
# pip install 'pre-commit==1.10.4' 'ipython==5.3.0' && \ RUN pip3.5 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
# pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \ pip3.5 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
# pip install opencv-python pip3.5 install opencv-python && \
pip3.6 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
# #For docstring checker pip3.6 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
# RUN pip3 install pylint pytest astroid isort pip3.6 install opencv-python && \
# RUN pip install pylint pytest astroid isort LinkChecker pip3.7 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
pip3.7 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
# COPY ./python/requirements.txt /root/ pip3.7 install opencv-python && \
# RUN pip3 install -r /root/requirements.txt pip install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
# RUN pip install -r /root/requirements.txt pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
pip install opencv-python
# # To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
# # the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2 #For docstring checker
# RUN apt-get install -y libssl-dev libffi-dev RUN pip3.5 install pylint pytest astroid isort
# RUN pip3 install certifi urllib3[secure] RUN pip3.6 install pylint pytest astroid isort
# RUN pip install certifi urllib3[secure] RUN pip3.7 install pylint pytest astroid isort
RUN pip install pylint pytest astroid isort LinkChecker
# # Install woboq_codebrowser to /woboq COPY ./python/requirements.txt /root/
# RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \ RUN pip3.5 install -r /root/requirements.txt
# (cd /woboq \ RUN pip3.6 install -r /root/requirements.txt
# cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \ RUN pip3.7 install -r /root/requirements.txt
# -DCMAKE_BUILD_TYPE=Release . \ RUN pip install -r /root/requirements.txt
# make)
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
# # Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service # the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
# RUN mkdir /var/run/sshd RUN apt-get install -y libssl-dev libffi-dev
# RUN echo 'root:root' | chpasswd RUN pip3.5 install certifi urllib3[secure]
# RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config RUN pip3.6 install certifi urllib3[secure]
# RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config RUN pip3.7 install certifi urllib3[secure]
# EXPOSE 22 RUN pip install certifi urllib3[secure]
# Install woboq_codebrowser to /woboq
RUN git clone https://github.com/woboq/woboq_codebrowser /woboq && \
(cd /woboq \
cmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \
-DCMAKE_BUILD_TYPE=Release . \
make)
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
EXPOSE 22
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册