Skip to content

Commit

Permalink
Merge pull request #143: Fix arm64 CVXOPT installation
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored May 4, 2023
2 parents a8a159f + fa48e73 commit 49b7282
Showing 1 changed file with 39 additions and 21 deletions.
60 changes: 39 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,6 @@ RUN curl -fsSL https://github.com/lh3/minimap2/releases/download/v2.24/minimap2-

# 3. Install programs via pip

# Build cvxopt on linux/arm64
# cvxopt, an Augur dependency, does not have pre-built binaries for linux/arm64.
#
# First, add system deps for building¹:
# - libopenblas-dev: Contains optimized versions of BLAS and LAPACK.
# - libsuitesparse-dev: Contains SuiteSparse.
#
# Then, "install" (build) separately since the process requires a special
# environment variable².
#
# ¹ https://cvxopt.org/install/#building-and-installing-from-source
# ² https://github.com/cvxopt/cvxopt/issues/125#issuecomment-407396491
RUN if [[ "$TARGETPLATFORM" == linux/arm64 ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
libopenblas-dev \
libsuitesparse-dev \
&& CVXOPT_SUITESPARSE_INC_DIR=/usr/include/suitesparse \
pip3 install cvxopt \
; \
fi

# Install jaxlib on linux/arm64
# jaxlib, an evofr dependency, does not have official pre-built binaries for
# linux/arm64. A GitHub user has provided them in a fork repo.
Expand Down Expand Up @@ -239,6 +218,31 @@ RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master .
RUN pip3 install phylo-treetime

# Augur

# Build CVXOPT on linux/arm64
# CVXOPT, an Augur dependency, does not have pre-built binaries for linux/arm64.
#
# First, add system deps for building¹:
# - libopenblas-dev: Contains optimized versions of BLAS and LAPACK.
# - SuiteSparse: Download the source code so it can be built alongside CVXOPT.
#
# Then, "install" (build) separately since the process requires a special
# environment variable².
#
# ¹ https://cvxopt.org/install/#building-and-installing-from-source
# ² https://cvxopt.org/install/#ubuntu-debian
WORKDIR /cvxopt
RUN if [[ "$TARGETPLATFORM" == linux/arm64 ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
libopenblas-dev \
&& mkdir SuiteSparse \
&& curl -fsSL https://api.github.com/repos/DrTimothyAldenDavis/SuiteSparse/tarball/v5.8.1 \
| tar xzvpf - --no-same-owner --strip-components=1 -C SuiteSparse \
&& CVXOPT_SUITESPARSE_SRC_DIR=$(pwd)/SuiteSparse \
pip3 install cvxopt \
; \
fi

# Augur is an editable install so we can overlay the augur version in the image
# with --volume=.../augur:/nextstrain/augur and still have it globally
# accessible and importable.
Expand Down Expand Up @@ -309,6 +313,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get update && apt-get install -y nodejs

# Used for platform-specific instructions
ARG TARGETPLATFORM

# Install CVXOPT deps on linux/arm64
# CVXOPT, an Augur dependency, was built separately above without runtime deps¹
# packaged like they are for the amd64 wheel.
#
# ¹ https://cvxopt.org/install/#building-and-installing-from-source
RUN if [[ "$TARGETPLATFORM" == linux/arm64 ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
libopenblas-base \
; \
fi

# Configure bash for interactive usage
COPY bashrc /etc/bash.bashrc

Expand Down

0 comments on commit 49b7282

Please sign in to comment.