Last active
December 12, 2022 00:24
-
-
Save Marlin-Na/4990300772bc54ae29120ab1d8b28386 to your computer and use it in GitHub Desktop.
Setup symengine R package with miniconda in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -ex | |
#### Run this inside Ubuntu docker image | |
cd ~/ | |
apt-get update | |
apt-get install -y \ | |
wget \ | |
build-essential \ | |
gfortran \ | |
zlib1g-dev \ | |
libbz2-dev \ | |
liblzma-dev \ | |
libpcre2-dev \ | |
libcurl4-gnutls-dev \ | |
default-jdk | |
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh | |
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh -b -p ~/miniconda/ | |
~/miniconda/bin/conda init bash | |
# . ~/.bashrc | |
. ~/miniconda/etc/profile.d/conda.sh | |
conda create -y -n test_symengine | |
conda activate test_symengine | |
conda install -y gmp mpfr cmake | |
hash -r | |
CWD=`pwd` | |
VERSION=4.2.2 | |
wget http://cloud.r-project.org/src/base/R-4/R-$VERSION.tar.gz | |
tar xf R-$VERSION.tar.gz | |
(cd R-$VERSION && \ | |
PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig \ | |
CPPFLAGS=-I$CONDA_PREFIX/include \ | |
LDFLAGS="-L$CONDA_PREFIX/lib -Wl,-rpath=$CONDA_PREFIX/lib" \ | |
./configure --prefix=$CWD/usr --with-readline=no --with-x=no) | |
(cd R-$VERSION && make -j48) | |
(cd R-$VERSION && make install) | |
# Needs cmake from conda environment. | |
# while [ ! -z $CONDA_PREFIX ]; do conda deactivate; done | |
~/usr/bin/R -e 'install.packages("Rcpp", repos="http://cran.us.r-project.org")' | |
wget https://cran.r-project.org/src/contrib/symengine_0.2.2.tar.gz | |
~/usr/bin/R -e 'install.packages("symengine_0.2.2.tar.gz", repos=NULL, type="source")' | |
~/usr/bin/R -e 'library(symengine); print(S(~ x)^2L)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment