Open diazrenata opened 1 year ago
Possible solution for #64.
Would involve merging #106.
Inside a clean rocker/rstudio latest-daily
image do all this:
apt update; apt install libgsl-dev libpng-dev
<- Required for msprime and 'png' library which is required for reticulatewget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
then bash Miniconda3-latest-Linux-aarch64.sh
and follow the promptsconda install -c bioconda python-newick -y
and conda install -c conda-forge pandas -y
msprime must be built from source on arm (no aarch64 package in conda-forge):
git clone --recurse-submodules https://github.com/tskit-dev/msprime.git
cd msprime; pip install .
install.packages("remotes")
install.packages("reticulate")
library(reticulate)
library(remotes)
reticulate::use_condaenv('base') # <- Tell reticulate to use the externally installed conda env
# NB: use reticulate::conda_list() to check the env name if this is not correct, but it should be by default
remotes::install_github('role-model/roleR', force=TRUE)
Then this:
library(roleR)
## init_type may be bridge_island or oceanic_island
p <- roleParams(individuals_local = 100, individuals_meta = 10000,
species_meta = 10, speciation_local = 0,
speciation_meta = 0.05, extinction_meta = 0.05, env_sigma = 0.5,
trait_sigma=1, comp_sigma = 0.5, dispersal_prob = 0.01, mutation_rate = 1e-6,
equilib_escape = 1, num_basepairs = 500, alpha = 10000,
init_type = 'bridge_island', niter = 100000, niterTimestep = 10000)
model <- runRole(roleModel(p))
Works.
I encapsulated all the changes needed into one shell script which is now stored in the roleR git repo inside the 'inst' directory. It should be smart enough to detect and work on arm vs x86. This runs everything and sets the environment so you can run the import(roleR)
immediately:
Inside a fresh rocker/rstudio container, in the terminal window do this:
wget https://raw.githubusercontent.com/role-model/roleR/main/inst/role_rocker_intall.sh
bash role_rocker_install.sh
Following this guide for modifying docker images. To get the role docker images pushed up to docker hub do this:
On a mac M1/M2:
docker ps -a
and then commit the changes to a new image: docker commit [containerID] mess-docker:mac-m1
docker login
docker tag mess-docker:mac-m1 iovercast/mess:mac-m1
docker push iovercast/role:mac-m1
Now do the same thing on a linux machine and replace mac-m1 with intel
On a headless box you can do this:
docker pull rocker/rstudio:latest-daily
# Do NOT include `--rm` in the run command or else the container you update will get auto-deleted. FML!
docker run -p 8787:8787 -e PASSWORD=rstudio mess-docker:intel
# Find the container hash of the running container
docker ps -a
docker exec -it <container_hash> /bin/bash
# Then run the install script
wget https://raw.githubusercontent.com/role-model/roleR/main/inst/role_rocker_intall.sh
bash role_rocker_install.sh
FULL DOCKER IMAGE INSTALL AND PUSH INSTRUCTIONS:
Install Docker Desktop https://www.docker.com/products/docker-desktop/
Launch Docker Desktop, go to Images, and search for rocker/rstudio
and select the latest-daily
tag. (This is important because the latest-daily
build routinely supports both amd64 and arm64 architecture for the host machine. Most of the other builds only support amd64, and M1 Macs want arm.) Pull, then Run.
On 'Run', under Optional parameters set the local port to 8787. You can also set a password for your session by entering the environment variable PASSWORD and rstudio
.
Inside a fresh rocker/rstudio container, in the terminal window do this:
wget https://raw.githubusercontent.com/role-model/roleR/main/inst/role_rocker_intall.sh
bash role_rocker_install.sh
Following this guide for modifying docker images. To get the role docker images pushed up to docker hub do this:
On a mac M1/M2:
docker ps -a
and then commit the changes to a new image: docker commit [containerID] mess-docker:mac-m1
docker tag mess-docker:mac-m1 iovercast/mess:mac-m1
docker push iovercast/mess:mac-m1
Now pull it and test it.
On intel:
docker ps -a
docker commit [containerID] mess-docker:intel
docker tag mess-docker:intel iovercast/mess:intel
docker push iovercast/mess:intel
What RMD did:
rocker/rstudio
and select thelatest-daily
tag. (This is important because thelatest-daily
build routinely supports both amd64 and arm64 architecture for the host machine. Most of the other builds only support amd64, and M1 Macs want arm.) Pull, then Run.8787:8787
link (or go to http://localhost:8787/ in a browser). Enter the password for the session. The user name is rstudio.install_packages("remotes")
remotes::install_github('role-model/roleR@nopika')
(The nopika branch has removed the pika dependency, because pika depends on gmp, and installing gmp requires sudo permissions that seem...complicated on Docker.roleR
only uses pika to generate a logseries SAD, so I ported the relevant code over from pika and removed it as a dependency).