forked from microbiome/OMA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PackageInstallations_Troubleshoots.qmd
125 lines (90 loc) · 3.91 KB
/
PackageInstallations_Troubleshoots.qmd
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
---
title: "Troubleshooting tips for installing miaverse packages"
output: html_document
---
```{r}
#| label = "setup",
#| include = FALSE
knitr::opts_chunk$set(echo = TRUE)
```
First of all, please ensure that you have an up-to-date version of R
(this note is based on R 4.3.1).
## Mac M1 user
When attempting to install miaverse packages, you may encounter
installation failures related to the 'scuttle' and 'scatter'
dependencies, which require a gcc compiler for installation. The error
message might resemble the following:
```
ld: warning: directory not found for option
'-L/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0'
ld: warning: directory not found for option '-L/opt/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
```
This error indicates that R is unable to locate the 'libgfortran'
during the package compilation process. If you encounter this error,
you can use the following workaround:
1. Install 2 essentials tools in order to compile R for macOS as
described in [Mac-r-project](https://mac.r-project.org/tools/)
- install the xcode:
- sudo xcode-select --install
- GNU Fortran compiler*
- download from
[here](https://mac.r-project.org/tools/gfortran-12.2-universal.pkg)
*you can also install from package manager for example homebrew,
but it is not reccomended.
2. Locate the gfortran using `which gfortran` to find the version of
gfortran that is stored in your ~/.bashrc or ~/bash_profile. Make sure
it pointing to the gfortran that you want to use. For example if you
have both homebrew and mac-r project gfortran, you may want to add the
mac-r project gfortran to your $PATH variable.
- add `export PATH="/opt/gfortran/bin:$PATH"` to your ~/.bash_profile
or ~/.bashrc, followed by `source ~/.bash_profile` in your terminal
3. Modify your `/Library/Frameworks/R.framework/Resources/etc/Makeconf`
from:
```
FLIBS = -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 /11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm
```
to*:
```
FLIBS = -L/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0 -L/opt/gfortran/lib -lgfortran -lm -lquadmath
```
*note that the path is depend on your installations site, sometimes it
is located in `/usr/local/gfortran/lib` so you have to change
`/opt/gfortran/lib` accordingly in the lines above.
After all of those steps, you can follow the installations based on
Bioconductor page. For example for mia package:
```
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("mia")
```
If the installations prompt to compile from source, you can answer yes,
and hopefully it can be successfully compiled. Good Luck!
Follow-up reading:
- https://support.bioconductor.org/p/9138121/
- https://medium.com/biosyntax/following-up-library-dependency-when-compiling-r-packages-89f191b9f227
Session info at the time of writing
```
sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Helsinki
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.3.1 bookdown_0.36 fastmap_1.1.1 cli_3.6.1
[5] htmltools_0.5.6.1 tools_4.3.1 rstudioapi_0.15.0 yaml_2.3.7
[9] rmarkdown_2.25 knitr_1.44 xfun_0.40 digest_0.6.33
[13] rlang_1.1.1 evaluate_0.22
```
## Linux user
For Ubuntu package please see [here](https://packages.ubuntu.com/)