Trouble Building PyMC Docker Image on Windows

Hi , I’m new to both open source contributions and PyMC.Since building document is not supported on windows i am trying to run PYMC in docker but I am running into this error while building a docker image.

after executing this cmd - bash scripts/docker_container.sh build

the error starts from here -


#8 248.6 done
#8 248.7 Installing pip dependencies: ...working... Pip subprocess error:
#8 251.2   ERROR: Error [Errno 2] No such file or directory: 'git' while executing command git version
#8 251.2 ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
#8 251.2
#8 251.2 Ran pip subprocess with arguments:
#8 251.2 ['/opt/conda/envs/pymc-dev/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/jovyan/condaenv.q71__6yo.requirements.txt']
#8 251.2 Pip subprocess output:
#8 251.2 Collecting git+https://github.com/pymc-devs/pymc-sphinx-theme (from -r /home/jovyan/condaenv.q71__6yo.requirements.txt (line 1))
#8 251.2   Cloning https://github.com/pymc-devs/pymc-sphinx-theme to /tmp/pip-req-build-v7yd_g38
#8 251.2
#8 251.2 failed
#8 251.2
#8 251.2 CondaEnvException: Pip failed
#8 251.2
#8 ERROR: process "/bin/bash -o pipefail -c mamba env create -f environment-dev.yml &&     /bin/bash -c \". activate pymc-dev &&     mamba install -c conda-forge -y pymc git\" &&     conda clean --all -f -y" did not complete successfully: exit code: 1
------
 > [3/6] RUN mamba env create -f environment-dev.yml &&     /bin/bash -c ". activate pymc-dev &&     mamba install -c conda-forge -y pymc git" &&     conda clean --all -f -y:
251.2 Ran pip subprocess with arguments:
251.2 ['/opt/conda/envs/pymc-dev/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/jovyan/condaenv.q71__6yo.requirements.txt']
251.2 Pip subprocess output:
251.2 Collecting git+https://github.com/pymc-devs/pymc-sphinx-theme (from -r /home/jovyan/condaenv.q71__6yo.requirements.txt (line 1))
251.2   Cloning https://github.com/pymc-devs/pymc-sphinx-theme to /tmp/pip-req-build-v7yd_g38
251.2
251.2 failed
251.2
251.2 CondaEnvException: Pip failed
251.2
------
Dockerfile:12
--------------------
  11 |     COPY /conda-envs/environment-dev.yml .
  12 | >>> RUN mamba env create -f environment-dev.yml && \
  13 | >>>     /bin/bash -c ". activate pymc-dev && \
  14 | >>>     mamba install -c conda-forge -y pymc git" && \
  15 | >>>     conda clean --all -f -y
  16 |
--------------------
ERROR: failed to solve: process "/bin/bash -o pipefail -c mamba env create -f environment-dev.yml &&     /bin/bash -c \". activate pymc-dev &&     mamba install -c conda-forge -y pymc git\" &&     conda clean --all -f -y" did not complete successfully: exit code: 1
(base)
 
1 Like

Hi!
It seems bash scripts/docker_container.sh build calls for building an image using the Dockerfile and inside the Dockerfile step 3 is the following:

RUN mamba env create -f environment-dev.yml && \
    /bin/bash -c ". activate pymc-dev && \
    mamba install -c conda-forge -y pymc" && \
    conda clean --all -f -y

This tries to create an environment using the environment-dev.yml file.

In turn, the environment-dev.yml file specifies that
- git+https://github.com/pymc-devs/pymc-sphinx-theme
should be installed, and this requires GIT.

The starting image jupyter/base-notebook:python-3.9.12 has not git installed, so the process fails.

Unfortunately, it seems the starting image also does not give sudo/root permission to adding a simple “RUN apt update;apt install git” inside the Dockerfile won’t suffice either.

Assuming that you just want to run the following Build documentation locally — PyMC 5.10.3 documentation, my workaround would be to just run a docker image with conda such as continuumio/miniconda3 and try from there.

Something like:

git clone https://github.com/pymc-devs/pymc.git
cd pymc
docker run -it -v $(pwd):/workspace continuumio/miniconda3 bash

Then inside the docker:

cd workspace
conda env create -f conda-envs/environment-docs.yml  

And then go on with the rest of the guide (pip install -e… etc.)

Note: conda install -f conda-envs/environment-docs.yml in the documentation is wrong.
To install a conda env with the environment.yml file the command is the above
conda env create -f conda-envs/environment-docs.yml

2 Likes

I was trying the workaround inside a docker in a Linux machine and it was taking forever to create the environment from the yml file (it was stuck at “solving the environment”).

I added the following step before the conda env create and it created the environment in like a couple of minutes:
conda update -n base conda
then
conda env create -f conda-envs/environment-docs.yml

1 Like

Thanks for the reply @ec_ai . I don’t know why but after executing -
$ docker run -it -v $(pwd):/workspace continuumio/miniconda3 bash
the workspace is not in the same dir -

(base) root@fd6a07342dab:/# cd workspace
bash: cd: workspace: No such file or directory
(base) root@fd6a07342dab:/# ls
'\Program Files\Git\workspace'   boot   etc    lib     media   opt    root   sbin   sys   usr
 bin                             dev    home   lib64   mnt     proc   run    srv    tmp   var

And of course if i navigate to '\Program Files\Git\workspace' then for conda env create -f conda-envs/environment-docs.yml it’s saying no such file or dir.

Ps: I ran the $ docker run -it -v $(pwd):/workspace continuumio/miniconda3 bash while I was in the right dir i.e pymc

Replace $(pwd) with the directory where you cloned the github repo :slight_smile:

(My mistake: pwd is actually the Linux command to get the present working directory, I don’t know the Windows equivalent)