FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Single pip install for compatibility · ZahidSQLDBA/docker-python@b189793 · GitHub

Commit b189793

Browse files
authored
Single pip install for compatibility
http://b/293471770
1 parent 2a8c4dd commit b189793

1 file changed

Lines changed: 17 additions & 22 deletions

File tree

‎tpu/Dockerfile‎

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,35 @@ ADD patches/kaggle_datasets.py /root/.local/lib/python3.8/site-packages/kaggle_d
3131
# sitecustomize adds significant latency to ipython kernel startup and should only be added if needed
3232
# ADD patches/sitecustomize.py /root/.local/lib/python3.8/site-packages/sitecustomize.py
3333

34-
# LIBTPU installed here:
35-
ENV PIP_LIBTPU=/usr/local/lib/python3.8/site-packages/libtpu/libtpu.so
36-
ENV PYTORCH_LIBTPU=/lib/torch-libtpu.so
34+
# Install them all the following together for maximum compatibility.
3735

38-
# Tensorflow wheel:
39-
RUN pip install tensorflow_hub https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/tensorflow/tf-${TENSORFLOW_VERSION}/tensorflow-${TENSORFLOW_VERSION}-cp38-cp38-linux_x86_64.whl \
40-
tensorflow-addons tensorflow-probability tensorflow-io
41-
RUN curl --output /lib/libtpu.so https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/libtpu/${TF_LIBTPU_VERSION}/libtpu.so
42-
ADD patches/kaggle_module_resolver.py /usr/local/lib/python3.8/site-packages/tensorflow_hub/kaggle_module_resolver.py
43-
RUN sed -i '/from tensorflow_hub import uncompressed_module_resolver/a from tensorflow_hub import kaggle_module_resolver' /usr/local/lib/python3.8/site-packages/tensorflow_hub/config.py
44-
RUN sed -i '/_install_default_resolvers()/a \ \ registry.resolver.add_implementation(kaggle_module_resolver.KaggleFileResolver())' /usr/local/lib/python3.8/site-packages/tensorflow_hub/config.py
36+
# Install Tensorflow.
4537

4638
# Install Pytorch & related packages
4739
# https://cloud.google.com/tpu/docs/pytorch-xla-ug-tpu-vm#changing_pytorch_version
4840
# The URL doesn't include patch version. i.e. must use 1.11 instead of 1.11.0
4941
# We need to keep the numpy version the same as the installed tf one but compatible with other installs.
50-
RUN NUMPYVER=$(pip freeze | grep -e "^numpy==") && \
51-
pip install torch==${TORCH_VERSION} https://storage.googleapis.com/tpu-pytorch/wheels/tpuvm/torch_xla-${TORCH_VERSION%.*}-cp38-cp38-linux_x86_64.whl torchvision==${TORCHVISION_VERSION} torchtext==${TORCHTEXT_VERSION} torchaudio==${TORCHAUDIO_VERSION} \
52-
https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/tensorflow/tf-${TENSORFLOW_VERSION}/tensorflow-${TENSORFLOW_VERSION}-cp38-cp38-linux_x86_64.whl \
53-
"${NUMPYVER}"
5442

5543
# Install JAX & related packages
5644
# https://cloud.google.com/tpu/docs/jax-quickstart-tpu-vm#install_jax_on_your_cloud_tpu_vm
57-
# We need to keep the numpy version the same as the installed tf one but compatible with other installs.
58-
RUN NUMPYVER=$(pip freeze | grep -e "^numpy==") && \
45+
46+
# Packages needed by the Notebook editor
47+
48+
# Additional useful packages should be added here
49+
50+
RUN pip install tensorflow_hub https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/tensorflow/tf-${TENSORFLOW_VERSION}/tensorflow-${TENSORFLOW_VERSION}-cp38-cp38-linux_x86_64.whl tensorflow-addons tensorflow-probability tensorflow-io \
51+
pip install torch==${TORCH_VERSION} https://storage.googleapis.com/tpu-pytorch/wheels/tpuvm/torch_xla-${TORCH_VERSION%.*}-cp38-cp38-linux_x86_64.whl torchvision==${TORCHVISION_VERSION} torchtext==${TORCHTEXT_VERSION} torchaudio==${TORCHAUDIO_VERSION} \
5952
pip install jax[tpu]==${JAX_VERSION} -f https://storage.googleapis.com/jax-releases/libtpu_releases.html trax flax optax elegy git+https://github.com/deepmind/dm-haiku jraph distrax \
60-
https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/tensorflow/tf-${TENSORFLOW_VERSION}/tensorflow-${TENSORFLOW_VERSION}-cp38-cp38-linux_x86_64.whl \
61-
"${NUMPYVER}"
53+
papermill jupyterlab python-lsp-server[all] "jupyter-lsp==1.5.1" \
54+
pandas matplotlib opencv-python-headless librosa scikit-learn
6255

63-
# Packages needed by the Notebook editor:
64-
RUN pip install papermill jupyterlab python-lsp-server[all] "jupyter-lsp==1.5.1"
56+
# Tensorflow libtpu:
57+
RUN curl --output /lib/libtpu.so https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/libtpu/${TF_LIBTPU_VERSION}/libtpu.so
6558

66-
# Additional useful packages should be added here:
67-
RUN pip install pandas matplotlib opencv-python-headless librosa scikit-learn
59+
# Kaggle Model Hub patches:
60+
ADD patches/kaggle_module_resolver.py /usr/local/lib/python3.8/site-packages/tensorflow_hub/kaggle_module_resolver.py
61+
RUN sed -i '/from tensorflow_hub import uncompressed_module_resolver/a from tensorflow_hub import kaggle_module_resolver' /usr/local/lib/python3.8/site-packages/tensorflow_hub/config.py
62+
RUN sed -i '/_install_default_resolvers()/a \ \ registry.resolver.add_implementation(kaggle_module_resolver.KaggleFileResolver())' /usr/local/lib/python3.8/site-packages/tensorflow_hub/config.py
6863

6964
# Monkey-patch the default TPU to the local (TPU VM).
7065
RUN sed -i 's/tpu=None,/tpu="local",/' /usr/local/lib/python3.8/site-packages/tensorflow/python/distribute/cluster_resolver/tpu/tpu_cluster_resolver.py

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL