/
installation_instructions.Rmd
82 lines (61 loc) · 3.65 KB
/
installation_instructions.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "Installation Instructions"
author: "Riley Xin"
date: "2023-10-06"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Installation Instructions}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## General
This guide navigates through some quirks and considerations during the installation of the `rosace` and `cmdstanr` packages, particularly those related to compiler configurations on different operating systems. While installations on the latest MacOS and Linux with Ubuntu have been smooth, we've noted a few issues for installing on the Linux CentOS distribution related to C++ configurations. Alternatively, you may want to use a Docker container with the image we provided to bypass those issues.
## Installing `cmdstanr`
Before installing `rosace`, you will need to install `cmdstanr` first using the code below.
```{r install cmdstanr, eval=FALSE}
install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
# Use cmdstanr to install CmdStan, this requires a working C++ toolchain and compiler
library(cmdstanr)
install_cmdstan(cores = 2)
# Check that installation is successful by checking the CmdStan version
cmdstan_version()
```
If you are downloading on a Linux platform and encounter errors, it is likely due to requirements for a C++ complier since `stan` is built in C++. According to [stan-dev](https://github.com/stan-dev/stan/wiki/Coding-Style-and-Idioms#supported-cpp-versions-and-compilers), `stan` is tested on Linux with g++ 5 (a compiler for C++). Ensure that your system is equipped with a gcc version > 5 which includes g++. You can check the current version in the terminal using:
```{bash, eval=FALSE}
gcc --version
```
If gcc is not installed or if your version is below the required, you'll need to install or upgrade it, following guidelines specific to your Linux distribution. You may check the distribution information in the terminal using:
```{bash, eval=FALSE}
lsb_release -a
```
## Installing `impute`
If you encounter `xx is not available for this version of R`, or `xx is not available for rosace` during the automatic installation, you may try download it manually. For example, the package `impute` is not available on CRAN and can be downloaded using the following:
```{r, eval = FALSE}
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("impute")
```
## Using Docker
If you prefer to use a Docker container to run the analysis, we've provided a Docker image for `rosace`. Please follow the [instructions](https://docs.docker.com/desktop/) to install Docker on your system. Once Docker is installed, you can pull the rosace Docker image with the following command:
```{sh, eval = FALSE}
docker pull cbmacdo/rosace-docker
```
To run the Docker container and access its shell environment, use a command similar to the following, which creates a container and enters an interactive shell environment
```{sh, eval = FALSE}
docker run --rm --platform linux/amd64 -it --entrypoint bash --name rosacecontainer cbmacdo/rosace-docker
```
You may also add an argument to mount your local directories or data files to the container. Replace `/PATH/TO/DATADIR` with the actual path to your data directory on your local system:
```{sh, eval = FALSE}
docker run --rm --platform linux/amd64 -it -v /PATH/TO/DATADIR:/home/rosace/data --entrypoint bash --name rosacecontainer cbmacdo/rosace-docker
```
Once you are in the container, you may invoke R with:
```{sh, eval = FALSE}
R
```
And start the analysis by loading the `rosace` package:
```{r eval = FALSE}
library("rosace")
```