@@ -54,6 +54,7 @@ source /etc/lsb-release
5454# - https://github.com/onnx/onnx/blob/master/docs/Versioning.md
5555# - https://github.com/onnx/onnx-tensorflow/blob/master/Versioning.md
5656
57+ # default version values
5758VER_TENSORFLOW=2.12.1
5859VER_TF_PROB=0.20.1
5960VER_TF_ADON=0.20.0
@@ -63,18 +64,31 @@ VER_ONNX_TF=1.10.0
6364VER_PYDOT=1.4.2
6465VER_TORCH=" 2.1.2+cpu"
6566VER_PROTOBUF=4.23.3
66-
67- # Install tensorflow
67+ VER_NUMPY=1.24.3
6868
6969echo " Setting version for '$DISTRIB_CODENAME '"
7070if [[ " $DISTRIB_CODENAME " == " bionic" ]]; then
71- : # use as is
71+ : # use default
7272elif [[ " $DISTRIB_CODENAME " == " focal" ]]; then
73- : # use as is
73+ : # use default
7474elif [[ " $DISTRIB_CODENAME " == " jammy" ]]; then
75- : # TODO change vesions
75+ :
76+ # VER_TENSORFLOW=2.19.0
77+ # VER_TF_PROB=0.25.0
78+ # VER_TF_ADON=0.23.0
79+ # VER_ONNX=1.17.0
80+ # VER_ONNXRUNTIME=1.21.1
81+ # VER_TORCH="2.7.0+cpu"
82+ # VER_NUMPY=1.24.4
7683elif [[ " $DISTRIB_CODENAME " == " noble" ]]; then
77- : # TODO change vesions
84+ VER_TENSORFLOW=2.19.0
85+ VER_TF_PROB=0
86+ VER_TF_ADON=0 # EOL, don't exist in python3.12~
87+ VER_ONNX=1.17.0
88+ VER_ONNXRUNTIME=1.21.0
89+ VER_ONNX_TF=0
90+ VER_TORCH=" 2.7.0+cpu"
91+ VER_NUMPY=1.26.4
7892else
7993 echo " Error one-prepare-venv: Unsupported codename $DISTRIB_CODENAME "
8094 exit -1
@@ -97,15 +111,18 @@ if [[ ! -z "$ONE_PREPVENV_PIP_OPTION" ]]; then
97111fi
98112
99113${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade pip setuptools
100- if [ -n " ${EXT_TENSORFLOW_WHL} " ]; then
101- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install ${EXT_TENSORFLOW_WHL}
102- else
103- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install tensorflow-cpu==${VER_TENSORFLOW}
114+
115+ PYTHON_PACKAGES=" tensorflow-cpu==${VER_TENSORFLOW} "
116+
117+ PYTHON_PACKAGES+=" Pillow "
118+
119+ if [[ " $VER_TF_PROB " != " 0" ]]; then
120+ # Fix version to that of TF release date
121+ PYTHON_PACKAGES+=" tensorflow_probability==${VER_TF_PROB} "
122+ fi
123+ if [[ " $VER_TF_ADON " != " 0" ]]; then
124+ PYTHON_PACKAGES+=" tensorflow_addons==${VER_TF_ADON} "
104125fi
105- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install Pillow
106- # Fix version to that of TF release date
107- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install tensorflow_probability==${VER_TF_PROB}
108- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install tensorflow_addons==${VER_TF_ADON}
109126
110127# Install PyTorch and ONNX related
111128# NOTE set ONE_PREPVENV_TORCH_SOURCE to override options for source URL.
@@ -115,24 +132,26 @@ if [[ ! -z "$ONE_PREPVENV_TORCH_SOURCE" ]]; then
115132fi
116133# TODO remove torch message
117134echo " Torch from '${ONE_PREPVENV_TORCH_SOURCE} ' -> '${TORCH_SOURCE_OPTION} '"
118- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install torch==${VER_TORCH} ${TORCH_SOURCE_OPTION}
135+ PYTHON_PACKAGES+= " torch==${VER_TORCH} "
119136
120- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install onnx==${VER_ONNX}
137+ PYTHON_PACKAGES+= " onnx==${VER_ONNX} "
121138
122- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install onnxruntime==${VER_ONNXRUNTIME}
139+ PYTHON_PACKAGES+= " onnxruntime==${VER_ONNXRUNTIME} "
123140
124- # Provide install of custom onnx-tf
125- if [ -n " ${EXT_ONNX_TF_WHL} " ]; then
126- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install ${EXT_ONNX_TF_WHL}
127- else
128- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install onnx-tf==${VER_ONNX_TF}
141+ if [[ " $VER_ONNX_TF " != " 0" ]]; then
142+ PYTHON_PACKAGES+=" onnx-tf==${VER_ONNX_TF} "
129143fi
130144
131145# Fix version to that of TF release date
132- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade protobuf==${VER_PROTOBUF}
146+ PYTHON_PACKAGES+= " protobuf==${VER_PROTOBUF} "
133147
134- # Fix version with fsspec error on U20.04
135- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade fsspec==2024.6.1
148+ # Fix version with fsspec error
149+ PYTHON_PACKAGES+= " fsspec==2024.6.1 "
136150
137151# Install pydot for visq
138- ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install pydot==${VER_PYDOT}
152+ PYTHON_PACKAGES+=" pydot==${VER_PYDOT} "
153+
154+ # Install numpy 1.x
155+ PYTHON_PACKAGES+=" numpy==${VER_NUMPY} "
156+
157+ ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade ${PYTHON_PACKAGES} ${TORCH_SOURCE_OPTION}
0 commit comments