Skip to content

Commit 6ea80cb

Browse files
committed
fix: correct python 3.9
1 parent 7ca1892 commit 6ea80cb

File tree

5 files changed

+390
-11
lines changed

5 files changed

+390
-11
lines changed

‎.circleci/config.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ workflows:
7171
- master
7272
- build-docker-generic:
7373
context: dockerhub
74-
python_version: "3.9"
74+
python_version: "3.9-rc"
7575
docker_type: "cpu"
7676
filters:
7777
branches:
7878
only:
7979
- master
8080
- build-docker-generic:
8181
context: dockerhub
82-
python_version: "3.9"
82+
python_version: "3.9-rc"
8383
docker_type: "gpu"
8484
filters:
8585
branches:

‎build-dockerfiles.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ONE_DNN_VERSION="v0.21.5"
2626
# From https://github.com/docker-library/python/
2727
# Here, we give link to raw content on github, on master
2828

29-
for python_version in "3.7" "3.8" "3.9"; do
29+
for python_version in "3.7" "3.8" "3.9-rc"; do
3030
for type in "cpu" "gpu"; do
3131
echo "Building Python ${python_version} for ${type}"
3232
folder="$(readlink -f "${BASH_SOURCE[0]}" | xargs dirname)/dockerfiles/${python_version}/${type}"

‎dockerfiles/3.9-rc/cpu/Dockerfile‎

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# DO NOT MODIFY MANUALLY
2+
# GENERATED FROM SCRIPTS
3+
FROM ubuntu:20.04@sha256:31dfb10d52ce76c5ca0aa19d10b3e6424b830729e32a89a7c6eee2cda2be67a5
4+
5+
# Avoid tzdata interactive action
6+
ENV DEBIAN_FRONTEND noninteractive
7+
8+
# Adding Python to image
9+
10+
# Dockerfile generated fragment to install Python and Pip
11+
# Source: https://raw.githubusercontent.com/docker-library/python/master/3.9-rc/buster/slim/Dockerfile
12+
# Python: 3.9.0rc1
13+
# Pip: 20.2.2
14+
15+
16+
17+
18+
# ensure local python is preferred over distribution python
19+
ENV PATH /usr/local/bin:$PATH
20+
21+
# http://bugs.python.org/issue19846
22+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
23+
ENV LANG C.UTF-8
24+
25+
# runtime dependencies
26+
RUN apt-get update && apt-get install -y --no-install-recommends \
27+
ca-certificates \
28+
netbase \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568
32+
ENV PYTHON_VERSION 3.9.0rc1
33+
34+
RUN set -ex \
35+
\
36+
&& savedAptMark="$(apt-mark showmanual)" \
37+
&& apt-get update && apt-get install -y --no-install-recommends \
38+
dpkg-dev \
39+
gcc \
40+
libbluetooth-dev \
41+
libbz2-dev \
42+
libc6-dev \
43+
libexpat1-dev \
44+
libffi-dev \
45+
libgdbm-dev \
46+
liblzma-dev \
47+
libncursesw5-dev \
48+
libreadline-dev \
49+
libsqlite3-dev \
50+
libssl-dev \
51+
make \
52+
tk-dev \
53+
uuid-dev \
54+
wget \
55+
xz-utils \
56+
zlib1g-dev \
57+
# as of Stretch, "gpg" is no longer included by default
58+
$(command -v gpg > /dev/null || echo 'gnupg dirmngr') \
59+
\
60+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
61+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
62+
&& export GNUPGHOME="$(mktemp -d)" \
63+
# Fix to avoid GPG server problem
64+
&& echo "disable-ipv6" >> ${GNUPGHOME}/dirmngr.conf \
65+
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
66+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
67+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
68+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
69+
&& mkdir -p /usr/src/python \
70+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
71+
&& rm python.tar.xz \
72+
\
73+
&& cd /usr/src/python \
74+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
75+
&& ./configure \
76+
--build="$gnuArch" \
77+
--enable-loadable-sqlite-extensions \
78+
--enable-optimizations \
79+
--enable-option-checking=fatal \
80+
--enable-shared \
81+
--with-system-expat \
82+
--with-system-ffi \
83+
--without-ensurepip \
84+
&& make -j "$(nproc)" \
85+
LDFLAGS="-Wl,--strip-all" \
86+
&& make install \
87+
&& rm -rf /usr/src/python \
88+
\
89+
&& find /usr/local -depth \
90+
\( \
91+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
92+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
93+
\) -exec rm -rf '{}' + \
94+
\
95+
&& ldconfig \
96+
\
97+
&& apt-mark auto '.*' > /dev/null \
98+
&& apt-mark manual $savedAptMark \
99+
&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
100+
| awk '/=>/ { print $(NF-1) }' \
101+
| sort -u \
102+
| xargs -r dpkg-query --search \
103+
| cut -d: -f1 \
104+
| sort -u \
105+
| xargs -r apt-mark manual \
106+
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
107+
&& rm -rf /var/lib/apt/lists/* \
108+
\
109+
&& python3 --version
110+
111+
# make some useful symlinks that are expected to exist
112+
RUN cd /usr/local/bin \
113+
&& ln -s idle3 idle \
114+
&& ln -s pydoc3 pydoc \
115+
&& ln -s python3 python \
116+
&& ln -s python3-config python-config
117+
118+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
119+
ENV PYTHON_PIP_VERSION 20.2.2
120+
# https://github.com/pypa/get-pip
121+
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/5578af97f8b2b466f4cdbebe18a3ba2d48ad1434/get-pip.py
122+
ENV PYTHON_GET_PIP_SHA256 d4d62a0850fe0c2e6325b2cc20d818c580563de5a2038f917e3cb0e25280b4d1
123+
124+
RUN set -ex; \
125+
\
126+
savedAptMark="$(apt-mark showmanual)"; \
127+
apt-get update; \
128+
apt-get install -y --no-install-recommends wget; \
129+
\
130+
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
131+
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \
132+
\
133+
apt-mark auto '.*' > /dev/null; \
134+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
135+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
136+
rm -rf /var/lib/apt/lists/*; \
137+
\
138+
python get-pip.py \
139+
--disable-pip-version-check \
140+
--no-cache-dir \
141+
"pip==$PYTHON_PIP_VERSION" \
142+
; \
143+
pip --version; \
144+
\
145+
find /usr/local -depth \
146+
\( \
147+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
148+
-o \
149+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
150+
\) -exec rm -rf '{}' +; \
151+
rm -f get-pip.py
152+
153+
154+
155+
# Adding NVidia Ml repo
156+
RUN echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
157+
# Adding useful packages for the image
158+
RUN apt update \
159+
&& apt install gcc-10 g++-10 libgomp1 libopenblas-dev libomp-dev graphviz -y --no-install-recommends \
160+
&& apt autoclean \
161+
&& apt clean \
162+
&& rm -rf /var/lib/apt/lists/*
163+
164+
# Making gcc 10 and g++ 10 default compiler
165+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 \
166+
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 \
167+
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 \
168+
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
169+
170+
# Adding MKL-DNN (now OneDNN) to the image
171+
RUN savedAptMark="$(apt-mark showmanual)" \
172+
&& apt update \
173+
&& apt install make curl wget cmake git -y --no-install-recommends \
174+
&& git clone https://github.com/01org/mkl-dnn.git -b v0.21.5 --depth 1 \
175+
&& cd mkl-dnn/scripts && ./prepare_mkl.sh && cd .. \
176+
&& mkdir -p build && cd build && cmake .. && make \
177+
&& make install \
178+
&& cd ../.. && rm -rf mkl-dnn \
179+
&& apt-mark auto '.*' > /dev/null \
180+
&& apt-mark manual $savedAptMark \
181+
&& apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
182+
&& apt autoclean \
183+
&& apt clean \
184+
&& rm -rf /var/lib/apt/lists/*
185+
186+
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib
187+

0 commit comments

Comments
 (0)