-
Notifications
You must be signed in to change notification settings - Fork 4
/
INSTALL
129 lines (86 loc) · 4.68 KB
/
INSTALL
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
## Acknowlegment
I've adapted these instructions from the INSTALL file of package [baseflow](https://CRAN.R-project.org/package=baseflow).
## Installation
### Requirements
This package has been developed and tested on macOS (10.15 Catalina), using cross-platform languages (Rust and R) that should enable it to work on other platforms. Beginning with version 0.2-2, this package makes substantive use of parallel::mclapply, which does not actually parallelize computations on Windows due to that platform's lack of fork(). This will not affect correctness of results, only how long Windows users have to wait for them.
For installing this package from source, the following are needed:
* A building environmment such as is generally installed with R on Linux distributions. On Windows, **Rtools** (available [here](https://cran.r-project.org/bin/windows/Rtools/)).
* **cargo** Rust compilation platform, version 1.42 or above. Detailed installation instructions are given below.
### Rust platform
General instructions to install the Rust compilation platform are given on the website [RustUp](https://rustup.rs/). It can be installed without administrator privileges - you do not need to ask your local computer technician that does not know Rust.
#### Prior notice: PATH environment variable modification
By default, the Rust compilation plaform is installed in `$HOME/.cargo` on Unix platforms and `%USERPROFILE%/.cargo` on Windows. This directory is then added to the PATH environment variable for the user to be able to use the toolchain without refering to the installation directory.
If you plan to use Rust for other purpose than installing `precautionary`, you may prefer to set the *modify PATH variable* to *yes*. But if you wish only to build and install *precautionary*, to avoid any side-effect of the installation, you may set this option to *no* as explained below.
CRAN policy prohibits published R packages from altering the user environment or filesystem apart from the R session.
#### Windows
On Windows, download and launch the rustup-init.exe script (64 bits version is [here](https://win.rustup.rs/x86_64), 32 bits is [here](https://win.rustup.rs/i686)). In the command prompt window, choose the second option `Customize installation` and set configuration as below.
```
default host triple: i686-pc-windows-gnu
default toolchain: stable
profile: default
modify PATH variable: no
```
Then, choose the first option `Proceed with installation`.
On 64-bits Windows systems, you also need to install the x64 target. After installation, open a terminal and type:
```
%USERPROFILE%\cargo\.bin\rustup.exe target add x86_64-pc-windows-gnu
```
#### Unix systems (GNU/Linux and macOS)
On GNU/Linux platforms and other Unix systems, launch the following command into a terminal:
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
Here again, chose the second option `Customize installation` and set configuration as below.
For GNU/Linux 64 bits systems:
```
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
profile: default
modify PATH variable: no
```
For GNU/Linux 32 bits systems:
```
default host triple: i686-unknown-linux-gnu
default toolchain: stable
profile: default
modify PATH variable: no
```
For macOS with Intel x86-64 architecture:
```
default host triple: x86_64-apple-darwin
default toolchain: stable
profile: default
modify PATH variable: no
```
For macOS with ARM64 architecture (Apple Silicon):
```
default host triple: aarch64-apple-darwin
default toolchain: stable
profile: default
modify PATH variable: no
```
For other platforms, detailed information about Rust support can be found [here](https://doc.rust-lang.org/rustc/platform-support.html).
After modifying configuration, choose option 1 `Proceed with installation`.
### Package compilation and installation
Download the source package as a `.tar.gz` file. Start R and run the following command in the console, where `path_to_package` is the path of the downloaded `.tar.gz` file of the package.
```
install.packages("path_to_package", repos = NULL, type = "source")
```
On Windows, you can directly download the binary `.zip` file, and run the following command, where `path_to_binary_package` is the path of the downloaded `.zip` file of the package.
```
install.packages("path_to_binary_package", repos = NULL, type = "win.binary")
```
After installation, try to load package using command
```
library(precautionary)
```
### Uninstalling Rust platform after installation
To uninstall Rust toolchain after installing the package, use the following commands:
On Windows:
```
%USERPROFILE%\cargo\.bin\rustup.exe self uninstall
```
On Unix-based systems (macOS and GNU/Linux):
```
~/cargo/.bin/rustup self uninstall
```