I am trying to build a docker container that will enable me to run my code that requires the python torch module.
I have chosen to start my image from the pytorch/pytorch:latest
base image and add a few required modules manually. The build, push, and pull to the remote server were successful (no error messages at least).
Currently my Dockerfile looks like this:
FROM pytorch/pytorch:latest
RUN apt-get update \
&& apt-get install -y \
libgl1-mesa-glx \
libx11-xcb1 \
&& apt-get clean all \
&& rm -r /var/lib/apt/lists/*
RUN /opt/conda/bin/conda install --yes \
astropy \
matplotlib \
pandas \
glob2 \
PIL \
scikit-learn \
scikit-image \
numpy
However, when running my python script within the container, I get ImportError: No module named torch
. This strikes me as rather weird, as it leads me to assume that the pytorch base image does not include the torch module...?
I have nevertheless tried to add torch
to the list of modules to install in the Dockerfile, but then the initial build will already fail with the error message PackagesNotFoundError: The following packages are not available from current channels: - torch
. Following the advice given here did unfortunately not help me.
I'd appreciate any explanation as to why the torch module could not be found within the built container, and of course any help to fix this problem! Thanks!