Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python38 Installation Issue #55

Open
wants to merge 12 commits into
base: PublicCI
Choose a base branch
from
10 changes: 8 additions & 2 deletions tensorflow/tools/ci_build/Dockerfile.cpu-py38
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ RUN apt -y install gcc-7 g++-7
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7

# The following line installs the Python 3.8 cross-compilation toolchain.
RUN /install/install_pi_python3x_toolchain.sh "3.8"
# Install Python 3.8
# libffi-dev is needed for ctypes module of python3.8
RUN apt install libffi-dev
# libsqlite3-dev is needed for module named '_sqlite3'
RUN apt install libsqlite3-dev
RUN chmod 777 /install/install_python38.sh
RUN /install/install_python38.sh
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 0
RUN python3 -V
RUN /install/install_pip_packages_by_version.sh pip3

RUN /install/install_bazel.sh
RUN /install/install_proto3.sh
Expand Down
25 changes: 25 additions & 0 deletions tensorflow/tools/ci_build/install/install_python38.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

cd /usr/src
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
tar xzf Python-3.8.2.tgz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Google's container tensorflow/tensorflow:devel, they're using Python 3.8.10, do we want to install the same version as they have just for consistence?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will update to 3.8.10 and re-test for a while.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd Python-3.8.2
./configure --enable-optimizations --with-ensurepip=install --prefix=/usr/
make altinstall
rm /usr/src/Python-3.8.2.tgz
rm -rf /usr/src/Python-3.8.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add a link so /usr/bin/python point to this new python3.8?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not seem necessary. What is the benefit of letting /usr/bin/python point to python3.8?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 0
This step was run in the docker file, so no need to do in this file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good