From 9af628c17dc51e90b65bda11ce1eab850be5be7e Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Wed, 31 Aug 2016 02:26:30 +0000 Subject: [PATCH] Add pillow to docker image, reduce docker image compile time. ISSUE=4600057 git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1438 1ad973e4-5ce8-4261-8a94-b56d1f490c56 --- paddle/scripts/docker/Dockerfile.m4 | 1 + paddle/scripts/docker/build.sh | 13 +++++++++---- paddle/setup.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/paddle/scripts/docker/Dockerfile.m4 b/paddle/scripts/docker/Dockerfile.m4 index e5574254d91..89a1147103c 100644 --- a/paddle/scripts/docker/Dockerfile.m4 +++ b/paddle/scripts/docker/Dockerfile.m4 @@ -6,4 +6,5 @@ ENV IS_DEVEL=PADDLE_IS_DEVEL ENV WITH_DEMO=PADDLE_WITH_DEMO ENV PIP_INSTALL_ARGS "" ENV PIP_GENERAL_ARGS "" +ENV USE_UBUNTU_MIRROR OFF RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/build.sh b/paddle/scripts/docker/build.sh index 3083afbe481..1f74e1f1af2 100644 --- a/paddle/scripts/docker/build.sh +++ b/paddle/scripts/docker/build.sh @@ -7,7 +7,10 @@ function abort(){ trap 'abort' 0 set -e -sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +if [ ${USE_UBUNTU_MIRROR} == "ON" ]; then + sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g'\ + /etc/apt/sources.list +fi apt-get update apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ @@ -22,7 +25,8 @@ git clone https://github.com/baidu/Paddle.git paddle cd paddle mkdir build cd build -cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON -DCUDNN_ROOT=/usr/ +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON\ + -DCUDNN_ROOT=/usr/ -DWITH_STYLE_CHECK=OFF make -j `nproc` # because durning make install, there are several warning, so set +e, do not cause abort make install @@ -32,8 +36,9 @@ paddle version # print version after build if [ ${WITH_DEMO} == "ON" ]; then apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ - sed grep graphviz - pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML + sed grep graphviz libjpeg-dev zlib1g-dev + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt \ + PyYAML pillow fi if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. cd ~ diff --git a/paddle/setup.py b/paddle/setup.py index 69059732b54..fabe2a6b4c1 100644 --- a/paddle/setup.py +++ b/paddle/setup.py @@ -46,7 +46,7 @@ setup(name="py_paddle", packages=['py_paddle'], include_dirs = [np.get_include(), "../"], # include numpy and paddle. install_requires = [ - 'numpy>=1.10.1', # The numpy is required. + 'numpy>=1.8.0', # The numpy is required. 'protobuf>=2.4.1' # The paddle protobuf version ], ) -- GitLab