Installation conflicts of Fenics and Pytorch

Hi, I am building a Docker container and want to install Fenics and Pytorch in Python 3.8 with Miniconda. So far, I am installing Fenics via conda, as the official Fenics Docker image only supports Python 3.6 (as far as I know; if not how can I use Python3.8 with the official image?).

However, installing Fenics and Pytorch gives version conflicts (“Found conflicts! Looking for incompatible packages.”). The installation of Pytorch exits, as the version conflicts cannot be resolved.

I would appreciate any help to get Fenics & Pytorch working in Python3.8. Installing Pytorch to the official Docker image of Fenics is not a problem, but another Package requires me to use Python >= 3.8. Again, any help to use Python3.8 with the official image is also greatly appreciated.

The Dockerfile I use goes as follows:

FROM ubuntu:18.04

# Install base utilities
RUN apt-get upgrade && \ 
    apt-get update
    
RUN apt-get install -y build-essential  && \
    apt-get install -y wget && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install miniconda
ENV CONDA_DIR /opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
     /bin/bash ~/miniconda.sh -b -p /opt/conda

# Put conda in path so we can use conda activate
ENV PATH=$CONDA_DIR/bin:$PATH

RUN conda create --name fenicsgym python=3.8
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "fenicsgym", "/bin/bash", "-c"]
RUN conda install -c conda-forge fenics -y
RUN conda install pytorch torchvision cpuonly -c pytorch

I confirmed that the issue is the Pytorch version (1.10.2), as I do not get the same issues with a downgraded version. Its strange, however, that installing Pytorch version 1.10.2 on the official Fenics image (Python3.6) is no issue at all.