Skip to content

Commit

Permalink
added assimulo deps to pyproject for worker
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Oct 24, 2024
1 parent 1468c39 commit c9ff61b
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 96 deletions.
1 change: 1 addition & 0 deletions Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ RUN python3.10 -m pip install --upgrade pip \
&& poetry env use 3.10 \
&& poetry install --without=api,worker


# install smoldyn
# RUN . /app/.venv/bin/activate \
# && wget https://www.smoldyn.org/smoldyn-2.73.tgz \
Expand Down
176 changes: 82 additions & 94 deletions compose_worker/Dockerfile-compose_worker
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,6 @@

FROM ghcr.io/biosimulators/bio-check-base:latest

# TODO: start the fenics implementation
# RUN apt-get update && apt-get install -y petsc-dev \
# libopenmpi-dev \
# libspdlog-dev \
# libpugixml-dev \
# cmake \
# gcc \
# g++ \
# gfortran \
# && rm -rf /var/lib/apt/lists/* \
# && add-apt-repository ppa:fenics-packages/fenics -y \
# && apt update \
# && apt install -y fenicsx \
# && poetry run pip install meson-python meson ninja

# RUN poetry run pip install \
# biosimulators-utils[logging] \
# biosimulators-amici \
# biosimulators-copasi \
# biosimulators-pysces \
# biosimulators-tellurium

# add deps with extras
# RUN yes | poetry cache clear PyPI --all \
# && poetry add biosimulators-utils --extras=logging \
# && poetry add pysces --extras=sbml \
# && poetry add biosimulators-copasi --python="^3.10"

# os deps
RUN apt-get update && apt-get install -y libatlas-base-dev \
libhdf5-serial-dev \
Expand All @@ -49,85 +21,101 @@ RUN apt-get update && apt-get install -y libatlas-base-dev \
###################################
# PySCeS

# SUNDIALS
# SUNDIALS --> installation path is default cmake (/usr/local) with LD_LIBRARY_PATH as runtime location
# ignore certificate checking because certificate was expired as of 2021-11-10
# ARG SUNDIALS_VERSION=2.6.2
# RUN apt-get install -y --no-install-recommends \
# wget \
# cmake \
# make \
# g++ \
# \
# && cd /tmp \
# && wget --no-check-certificate https://computing.llnl.gov/sites/default/files/inline-files/sundials-${SUNDIALS_VERSION}.tar.gz \
# && tar xvvf sundials-${SUNDIALS_VERSION}.tar.gz \
# && cd sundials-${SUNDIALS_VERSION} \
# && mkdir build \
# && cd build \
# && cmake .. \
# && make \
# && make install \
# \
# && cd /tmp \
# && rm sundials-${SUNDIALS_VERSION}.tar.gz \
# && rm -r sundials-${SUNDIALS_VERSION}
# ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

# install assimulo because pipenv fails to install it
# ARG ASSIMULO_VERSION=3.2.9
# RUN pip install git+https://github.com/modelon-community/Assimulo.git@Assimulo-${ASSIMULO_VERSION}

# RUN pip install "cython<1.0" numpy scipy matplotlib

# install SUNDIALS and Assimulo
# ARG ASSIMULO_VERSION=3.4.3
# RUN apt-get update -y \
# && apt-get install -y --no-install-recommends \
# libsundials-dev \
# g++ \
# libblas-dev \
# liblapack-dev
# # libsundials-arkode5 \
# # libsundials-cvode6 \
# # libsundials-cvodes6 \
# # libsundials-ida6 \
# # libsundials-idas5 \
# # libsundials-kinsol6 \
# # libsundials-nvecserial6
# # && pip install --install-option="--optimize=1" \
# # --install-option="--extra-fortran-link-flags=-shared" \
# # --install-option="--sundials-home=/usr" \
# # --install-option="--blas-home=/usr/lib/x86_64-linux-gnu" \
# # --install-option="--lapack-home=/usr" \
# # --install-option="--extra-fortran-compile-flags=-fallow-argument-mismatch" \
# # --install-option="--extra-c-flags=-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION" \
# # git+https://github.com/modelon-community/Assimulo.git@Assimulo-${ASSIMULO_VERSION} \
# # \
#
# # fonts for matplotlib
# RUN apt-get update -y && apt-get install -y --no-install-recommends libfreetype6
# # && rm -rf /var/lib/apt/lists/*
ARG SUNDIALS_VERSION=2.6.2
RUN apt-get install -y --no-install-recommends \
wget \
cmake \
make \
g++ \
\
&& cd /tmp \
&& wget --no-check-certificate https://computing.llnl.gov/sites/default/files/inline-files/sundials-${SUNDIALS_VERSION}.tar.gz \
&& tar xvvf sundials-${SUNDIALS_VERSION}.tar.gz \
&& cd sundials-${SUNDIALS_VERSION} \
&& mkdir build \
&& cd build \
&& CFLAGS="-fPIC" cmake .. \
&& make \
&& make install \
\
&& cd /tmp \
&& rm sundials-${SUNDIALS_VERSION}.tar.gz \
&& rm -r sundials-${SUNDIALS_VERSION}
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

############################################
# App content

COPY . /app/worker

# install requirements in poetry via pip prox
# RUN poetry run pip install -r /app/worker/requirements.worker.txt
ENV PATH="/root/.local/bin:$PATH"

# install masspy TODO: do this
# RUN poetry run pip install biosimulators-masspy
# Install only worker deps
RUN poetry install --only=worker --no-cache

# install with poetry TODO: remove this eventually
# RUN /app/assets/install_deps.sh /app/worker/requirements.worker.txt

ENV PATH="/root/.local/bin:$PATH"
# Install Assimulo from source for Pysces
RUN apt-get update \
&& apt-get install -y libblas-dev \
liblapack-dev \
libatlas-base-dev \
python3-distutils \
python3-dev \
&& git clone https://github.com/modelon-community/Assimulo.git \
&& cd Assimulo \
&& poetry run pip install --upgrade setuptools pip wheel Cython numpy \
&& poetry run python3 setup.py install --sundials-home=/usr/local --blas-home=/usr/lib/x86_64-linux-gnu

# && cd Assimulo \
# && rm -rf build \
# && poetry run python3 setup.py install --sundials-home=/usr/local --blas-home=/usr/lib/x86_64-linux-gnu

RUN poetry install --only=worker
# install masspy TODO: do this
# RUN poetry run pip install biosimulators-masspy

WORKDIR /app/worker

RUN python3 -c "import os;files=os.listdir();import shutil;[shutil.rmtree(f) if '__pycache__' in f else None for f in files]"

ENTRYPOINT ["poetry", "run", "python3", "main.py"]

#############################
# Fenics

# TODO: start the fenics implementation
# RUN apt-get update && apt-get install -y petsc-dev \
# libopenmpi-dev \
# libspdlog-dev \
# libpugixml-dev \
# cmake \
# gcc \
# g++ \
# gfortran \
# && rm -rf /var/lib/apt/lists/* \
# && add-apt-repository ppa:fenics-packages/fenics -y \
# && apt update \
# && apt install -y fenicsx \
# && poetry run pip install meson-python meson ninja

# RUN poetry run pip install \
# biosimulators-utils[logging] \
# biosimulators-amici \
# biosimulators-copasi \
# biosimulators-pysces \
# biosimulators-tellurium

# add deps with extras
# RUN yes | poetry cache clear PyPI --all \
# && poetry add biosimulators-utils --extras=logging \
# && poetry add pysces --extras=sbml \
# && poetry add biosimulators-copasi --python="^3.10"

# install requirements in poetry via pip prox
# RUN poetry run pip install -r /app/worker/requirements.worker.txt

# install masspy TODO: do this
# RUN poetry run pip install biosimulators-masspy

# install with poetry TODO: remove this eventually
# RUN /app/assets/install_deps.sh /app/worker/requirements.worker.txt
Loading

0 comments on commit c9ff61b

Please sign in to comment.