1#!/bin/bash -eu
2# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16
17# Called like install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.10"
18PIP="$1"
19PIP_INSTALL=("${PIP}" "install" "--prefer-binary" --upgrade)
20
21PYTHON="${PIP/pip/python}"
22wget "https://bootstrap.pypa.io/get-pip.py"
23"${PYTHON}" "get-pip.py" --force-reinstall
24rm "get-pip.py"
25"${PYTHON}" -m ensurepip --upgrade
26
27PYTHON_VERSION=$(echo ${PIP##*.})  # only the last number, eg. 10
28
29PACKAGES=(
30  "absl-py"
31  "argparse"
32  "astor"
33  "auditwheel"
34  "bleach"
35  "dill"
36  "dm-tree"
37  "future"
38  "gast"
39  "grpcio"
40  "h5py"
41  "keras-nightly"
42  "keras_preprocessing"
43  "libclang"
44  "markdown"
45  "pandas"
46  "packaging"
47  "portpicker"
48  "protobuf"
49  "psutil"
50  "py-cpuinfo"
51  "pybind11"
52  "pycodestyle"
53  "pylint==2.7.4"
54  "scikit-learn"
55  "scipy"
56  "six"
57  "tb-nightly"
58  "tblib"
59  "termcolor"
60  "tf-estimator-nightly"
61  "werkzeug"
62  "wheel"
63)
64
65# Get the latest version of pip so it recognize manylinux2010
66"${PIP}" "install" "--upgrade" "pip"
67"${PIP}" "install" "--upgrade" "setuptools" "virtualenv"
68
69"${PIP_INSTALL[@]}" "${PACKAGES[@]}"
70
71# Special casing by version of Python
72# E.g., numpy supports py3.10 only from 1.21.3
73if [[ ${PYTHON_VERSION} -eq 10 ]]; then
74  "${PIP_INSTALL[@]}" "numpy==1.21.3"
75else
76  "${PIP_INSTALL[@]}" "numpy==1.19"
77fi
78
79