Create Docker Image for Titanic
Idea
I would like to have a docker_image
that is able to run dnadna
and compatible with the work already done on Titanic (sjupyter
, srun
, sbatch
, slurm
and other stuff that I don't know about).
The idea could be, in order to be helpful for everyone, to have a minimalist image upon which we can build other personalized images.
Issue
Actually, based on theophile's advice, I took his image thesanc/dlgene:0.993
(find link below) and made a Dockerfile to build another image.
Here is the docker file:
FROM thesanc/dlgene:0.993
WORKDIR /dnadna
COPY ./dnadna .
# Install DNADNA and dependencies
RUN conda env update -f environment-cuda.yml
RUN pip install -e .
# Make RUN commands use the new environment:
# SHELL ["conda", "run", "-n", "dnadna", "/bin/bash", "-c"]
# Make sure the environment is activated:
RUN echo "Make sure numpy is installed:"
RUN python -c "import numpy"
RUN conda env list
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]
RUN dnadna simulation init my_model one_event
And that was the kind of error we got (it is not exactly the same Dockerfile for this log):
Ran pip subprocess with arguments:
['/opt/conda/envs/dnadna/bin/python', '-m', 'pip', 'install', '-U', '-r', '/dnadna/condaenv.9xaucu34.requirements.txt']
Pip subprocess output:
Collecting mistletoe
Downloading mistletoe-0.7.2-py3-none-any.whl (28 kB)
Collecting m2r
Downloading m2r-0.2.1.tar.gz (16 kB)
Collecting pygments-csv-lexer
Downloading pygments-csv-lexer-0.1.3.tar.gz (7.4 kB)
Collecting sphinxcontrib-napoleon
Downloading sphinxcontrib_napoleon-0.7-py2.py3-none-any.whl (17 kB)
Collecting mistune
Downloading mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Requirement already satisfied, skipping upgrade: docutils in /opt/conda/envs/dnadna/lib/python3.7/site-packages (from m2r->-r /dnadna/condaenv.9xaucu34.requirements.txt (line 2)) (0.16)
Requirement already satisfied, skipping upgrade: Pygments>=2.1.0 in /opt/conda/envs/dnadna/lib/python3.7/site-packages (from pygments-csv-lexer->-r /dnadna/condaenv.9xaucu34.requirements.txt (line 3)) (2.6.1)
Requirement already satisfied, skipping upgrade: six>=1.5.2 in /opt/conda/envs/dnadna/lib/python3.7/site-packages (from sphinxcontrib-napoleon->-r /dnadna/condaenv.9xaucu34.requirements.txt (line 4)) (1.15.0)
Collecting pockets>=0.3
Downloading pockets-0.9.1-py2.py3-none-any.whl (26 kB)
Building wheels for collected packages: m2r, pygments-csv-lexer
Building wheel for m2r (setup.py): started
Building wheel for m2r (setup.py): finished with status 'done'
Created wheel for m2r: filename=m2r-0.2.1-py3-none-any.whl size=10466 sha256=cb8956f04cadfdc608e34028d89e413b952c934511fb1e14c11a5e7a9037fef2
Stored in directory: /root/.cache/pip/wheels/02/47/3a/e1c46c2cca442c8781612542397c9559a579f10e2dd87e7c9f
Building wheel for pygments-csv-lexer (setup.py): started
Building wheel for pygments-csv-lexer (setup.py): finished with status 'done'
Created wheel for pygments-csv-lexer: filename=pygments_csv_lexer-0.1.3-py3-none-any.whl size=4867 sha256=8abda8352d6c31f67a1908248e8f5e39534420d6cc53505a520e239f625c1c4e
Stored in directory: /root/.cache/pip/wheels/e9/5f/00/f1d98db0ff66c88bc3a6346e66b9fe183922c652478c879f17
Successfully built m2r pygments-csv-lexer
Installing collected packages: mistletoe, mistune, m2r, pygments-csv-lexer, pockets, sphinxcontrib-napoleon
Successfully installed m2r-0.2.1 mistletoe-0.7.2 mistune-0.8.4 pockets-0.9.1 pygments-csv-lexer-0.1.3 sphinxcontrib-napoleon-0.7
#
# To activate this environment, use
#
# $ conda activate dnadna
#
# To deactivate an active environment, use
#
# $ conda deactivate
Removing intermediate container ab6229abfdff
---> ffa0e9182a04
Step 6/6 : RUN conda activate dnadna
---> Running in 2c6d9d450192
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
Resulting in issues I have with Torch and Torchvision dependencies or Docker specialties:
-
thesanc.torch.__version__ == 1.5
/thesanc.torchvision.__version__
== 0.6 -
dnadna.torch.__version__ == 1.2
/dnadna.torch.__version__
== DONT_KNOW - Either
conda activate
is not running as expected (we can't switch todnadna
env) - Either the
<Shell>
is not running as expected (forcing to switch todnadna
env with shell commands)
Solution ?
- Link to Titanic doc, to pay attention to build-in package under Titanic
- there are already 'base' docker images on Titanic
- there is also Theophile's image
- there is also embray's miniconda image to run tests
To be honest, I don't really know what are inside these images, and what is the best solutions that is compatible with Titanic built-in functionalities and that would be helpful for everybody that wants to run dnadna
on Titanic (or any cluster)