0

I am trying to run a model and it asks me to build a docker environment. And I think I get an error message about my python? I do not understand it very much.

I have tried the top answer in Docker Alpine Linux python (missing), but I still receive the same error message. I wonder if it is the specific python package requirement the Dockerfile asks for? Do I need to install these packages one-by-one on the directory that the model is in?

RUN apk update && apk add gfortran \
    musl-dev bash python py-pip doxygen git graphviz

I have both Python and Gfortran installed.

$ which python
/opt/anaconda3/bin/python

$ which gfortran
/usr/local/bin/gfortran

$ python
Python 3.7.6 (default, Jan  8 2020, 13:42:34) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

This is what I have in the terminal

$ sudo docker build -t simstrat:alpine .
Sending build context to Docker daemon  13.31kB
Step 1/6 : FROM alpine:latest
 ---> a24bb4013296
Step 2/6 : MAINTAINER SURF Team "davide.vanzo@eawag.ch"
 ---> Using cache
 ---> e84c1b2e9e15
Step 3/6 : RUN apk update && apk add gfortran   musl-dev bash python py-pip doxygen git graphviz
 ---> Running in 7f7ed9219d01
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
v3.12.0-376-gb3fc85f1ac [http://dl-cdn.alpinelinux.org/alpine/v3.12/main]
v3.12.0-381-g200ba6e281 [http://dl-cdn.alpinelinux.org/alpine/v3.12/community]
OK: 12750 distinct packages available
ERROR:   python (missing):
unsatisfiable constraints:
    required by: world[python]
The command '/bin/sh -c apk update && apk add gfortran  musl-dev bash python py-pip doxygen git graphviz' returned a non-zero code: 1

This is the Docker file I have:

FROM alpine:latest
MAINTAINER SURF Team "davide.vanzo@eawag.ch"

# get the tools we need
RUN apk update && apk add gfortran \
    musl-dev bash python py-pip doxygen git graphviz

RUN pip install FoBiS.py ford pygooglechart

# root dir
RUN mkdir /home/Simstrat
WORKDIR /home/Simstrat

# calls that are needed to build and start the container with the build environment:
# docker build -t simstrat:alpine .
# docker create --name simstrat -it -v <pathToLocalGitRepoDirectory>:/home/Simstrat simstrat:alpine
# docker start simstrat
# docker exec -it simstrat bash
Tongyao Pu
  • 31
  • 5
  • 2
    Why not directly use python alpine docker image itself? – Wander3r Oct 11 '20 at 07:58
  • Check out this answer: https://stackoverflow.com/questions/62169568/docker-alpine-linux-python-missing – tania Oct 11 '20 at 08:21
  • I edited my docfile with the answer provided by another question, but I still got the same error. The docfile I had created an alpine image, but I guess it has to create a new image based on that? I was just following the instructions of the model. – Tongyao Pu Oct 11 '20 at 14:28

1 Answers1

1

Looking back, this question seems a bit stupid now. The original docker file has "python" instead of "python3" and this is why I got the error.

RUN apk update && apk add gfortran \
    musl-dev bash python3 py-pip doxygen git graphviz````
Tongyao Pu
  • 31
  • 5