Hello,
I run JupyterLab in docker with both tensorflow==2.12.0
and pytorch==2.0.1+cu118
installed. Pytorch can detector GPU, however, tensorflow failed. See bellow:
The docker image was build from jupyter/scipy-notebook:lab-3.6.3:
ARG OWNER=jupyter
ARG BASE_CONTAINER=jupyter/scipy-notebook:lab-3.6.3
FROM $BASE_CONTAINER
# reference: https://github.com/jupyter/docker-stacks/blob/975e7404e1b16091fee6ea6795f59104043c8092/tensorflow-notebook/Dockerfile
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN pip config set global.index-url http://mirrors.aliyun.com/pypi/simple
RUN pip config set install.trusted-host mirrors.aliyun.com
# Install Tensorflow
RUN pip --no-cache-dir install tensorflow==2.12.0
# Install Pytorch
RUN pip --no-cache-dir install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Elyra
RUN pip install --no-cache-dir --upgrade "elyra[all]>=3.7.0"
# jupyterlab-lsp
RUN pip install --no-cache-dir 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
Run pip install --no-cache-dir -U jedi-language-server
Run pip install --no-cache-dir 'python-lsp-server[all]'
# lckr-jupyterlab-variableinspector
RUN pip install --no-cache-dir lckr-jupyterlab-variableinspector
# HDF5
RUN pip install --no-cache-dir jupyterlab_hdf
RUN jupyter labextension install @jupyterlab/hdf5
# Some other extensions
RUN jupyter labextension install jupyterlab-spreadsheet
RUN pip install --no-cache-dir jupyterlab-spellchecker
RUN pip install --no-cache-dir jupyterlab-system-monitor
RUN pip install --no-cache-dir jupyterlab_execute_time
RUN pip install --no-cache-dir 'ipydrawio[all]'
RUN fix-permissions "${CONDA_DIR}" && fix-permissions "/home/${NB_USER}"
USER root
RUN apt update -y
RUN apt install vim -y
USER jovyan
COPY .pip /home/jovyan
WORKDIR /home/jovyan/work
The Dockerfile
above was built as follows:
docker build . -t jupyter/tensorflow-2.12_pytorch-2.01:v0.1
Finally I run the docker in command line:
docker run -it --gpus all --rm --name jupyter -p 8888:8888 \
-v /home/zhangxf/workdir:/home/jovyan/workdir \
jupyter/tensorflow-2.12_pytorch-2.01:v0.1
Why tensorflow failed to detector GPU? How can I fix this? Any help would be greatly appreciated!.