zdk123 / SpiecEasi

Sparse InversE Covariance estimation for Ecological Association and Statistical Inference
GNU General Public License v3.0
189 stars 66 forks source link

Errors when installing SpiecEasi either from R or Terminal - Macbook with macOS Big Sur and R 4.0.5 #165

Open edersonjesus opened 3 years ago

edersonjesus commented 3 years ago

Dear zdk123, hello!

I hope not to be repeating what others already asked here, but I looked at all issues that I could and I could not find a solution even though they looked similar.

I am having problems to install SpiecEasi in my computer. I have a Macbook Pro with macOS Big Sur (version 11.2.3), and I am using RStudio 1.2.5042 with R version 4.0.5 (2021-03-31).

I tried to install SpiecEasi from Rstudio and from Terminal using conda as recommended in answers to other users, but without any success. I also went to https://github.com/zdk123/SpiecEasi/commit/11fbe8227fae076f597c31cdefc3eb638d85fd88 and I was not able to succeed.

When doing that from RStudio, I get the following messages:

library(devtools) install_github("zdk123/SpiecEasi")

Downloading GitHub repo zdk123/SpiecEasi@HEAD ✓ checking for file ‘/private/var/folders/0r/1mhlv5h165ngn53sv00vcc5h0000gn/T/Rtmp5Vd0np/remotes120066acfced/zdk123-SpiecEasi-ff528b2/DESCRIPTION’ (1.7s) ─ preparing ‘SpiecEasi’: ✓ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts (427ms) ─ checking for empty or unneeded directories Removed empty directory ‘SpiecEasi/inst’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘SpiecEasi_1.1.1.tar.gz’

Installing package into ‘/Users/edersonjesus/Rlibs’ (as ‘lib’ is unspecified)

When I do it from Terminal, I get the following messages:

(base) Edersons-Air:~ edersonjesus$ conda install -c bioconda r-spieceasi Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: \ Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package tk conflicts for: r-spieceasi -> r-base[version='>=3.6,<3.7.0a0'] -> tk[version='>=8.6.8,<8.7.0a0'] python=3.8 -> tk[version='>=8.6.10,<8.7.0a0|>=8.6.8,<8.7.0a0']

Package libcxx conflicts for: r-spieceasi -> libcxx[version='>=11.1.0|>=9.0.1'] r-spieceasi -> r-rcpp -> libcxx[version='>=4.0.1']

I understand that the package versions are incompatible and that I cannot install SpiecEasi in this new R version, is that right? I tried to install these packages again, but that does not work. In fact, in a second round, other packages are indicated and I cannot succeed with the SpiecEasi installation.

I followed all instructions that I found here in zkd123’s github like reinstalling xcode and updating fortran, and I cannot solve the problem.

Another important piece of information: a similar error message happened when I tried to run the line install_github("kingaa/pomp") in https://kingaa.github.io/mac-fortran.html I am not going to post it here not to make the post too long. In fact, when I execute xcode-select —install , as told in the page before, I am told the following:

(base) Edersons-Air:~ edersonjesus$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates

At the end, I installed the binaries through another way.

Is SpiecEasi really compatible with the new versions of R and with the new iOS version?

What may be happening here? It seems that the package needs other versions of other R packages that are not available in R 4.0.5.

Thanks in advance!

zdk123 commented 3 years ago

Thanks for the thorough report @edersonjesus, this definitely looks like a new macOS installation bug.

I wanted to respond and say that SpiecEasi is definitely compatible with R 4.0 in general but I haven't tried running R on the new iOS chips yet so that could definitely be it.

I'm surprised to see a conda version constraint for r-base "<3.7.0a0". I'll take a look at that independently.

zdk123 commented 3 years ago

For the conda case, can you try creating a new environment and running:

conda create -n r-spieceasi -c conda-forge -c bioconda r-base=4 r-spieceasi

I suspect your existing conda environment might be downgrading r-base.

edersonjesus commented 3 years ago

@zdk123, It seems that it worked!

I had no error messages this time and, in the end, I see:

To activate this environment, use $ conda activate r-spieceasi To deactivate an active environment, use $ conda deactivate

However, what I should do to run it from within RStudio? From what I see, the package does not appear in the package list. This is the first time I installed a package in a new environment.

As for my computer, it runs with the old Intel chips (it is from 2017), but I updated the operating system to the new macOS Big Sur.

Thank you!

zdk123 commented 3 years ago

I'm still running Mojave but I haven't seen any Big Sur specific compiling issues. I'll keep this open.

I think this should work for Rstudio (from a terminal and in the desired working directory):

conda activate r-spieceasi
export RSTUDIO_WHICH_R=$CONDA_PREFIX/bin/R
open . -a rstudio
edersonjesus commented 3 years ago

@zdk123, thank you! The package does not appear in the list when I shut RStudio down. I have to call it from Terminal over and over again. So, I must run that from Terminal any time I need to use SpiecEasi, right?

A new piece of information if that is useful: I was having the same issues when I tried to install SpiecEasi in R for Windows, but that through a virtual machine (I have Parallels Desktop on my computer). I was running R 3.4.2 for Windows. I just installed R 4.0.5 for Windows and, now, I got a non-zero exit status error message even when trying to install devtools.

Thank you!

edersonjesus commented 3 years ago

I somehow managed to install it through RStudio. I did several things: re-installed xcode, quartz, R, and RStudio. However, I was having the same error. I got it working after I installed gfortran 10.2 for Big Sur (macOS 11), for Intel process as advised here https://github.com/fxcoudert/gfortran-for-macOS/releases through gfortran-10.2-BigSur-Intel.dmg

Here is the result:

library(devtools) Loading required package: usethis install_github("zdk123/SpiecEasi") Downloading GitHub repo zdk123/SpiecEasi@HEAD ✓ checking for file ‘/private/var/folders/0r/1mhlv5h165ngn53sv00vcc5h0000gn/T/RtmpYvUpC9/remotes49ad5b5dcb4d/zdk123-SpiecEasi-ff528b2/DESCRIPTION’ ... ─ preparing ‘SpiecEasi’: ✓ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘SpiecEasi/inst’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘SpiecEasi_1.1.1.tar.gz’

Thanks!

zdk123 commented 3 years ago

Oh wow thanks for sticking with this. I'll add that link to the readme.

mlosada323 commented 3 years ago

Hi there,

I had the issue as edersonjesus but installing gfortran 10.2 for Big Sur (macOS 11) didn't fix it for me - see error message below. My MacBook Pro is newer though, 2020. Any tips would be highly appreciated.

Thanks!!

install_github("zdk123/SpiecEasi") Downloading GitHub repo zdk123/SpiecEasi@HEAD ✓ checking for file ‘/private/var/folders/74/9l2dfqyj6qsdw0df7ycfwdv80000gn/T/RtmpKf0Kbq/remotes13d736ba1f91/zdk123-SpiecEasi-ff528b2/DESCRIPTION’ ... ─ preparing ‘SpiecEasi’: ✓ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘SpiecEasi/inst’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘SpiecEasi_1.1.1.tar.gz’

zdk123 commented 3 years ago

@mlosada323 That one's on me - these warnings are innocuous but devtools/remotes sometimes converts them to errors and fails on certain systems. I have a fix in a branch, but in the meantime you can (from R) set:

Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true")

so that the warnings don't stop installation.

mlosada323 commented 3 years ago

Thanks for your quick response. I ran the fix you suggested but the error persisted. I'm not an expert but could this missing library cause the error?

ld: library not found for -lquadmath

Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true") install_github("zdk123/SpiecEasi") Downloading GitHub repo zdk123/SpiecEasi@HEAD ✓ checking for file ‘/private/var/folders/74/9l2dfqyj6qsdw0df7ycfwdv80000gn/T/RtmpKf0Kbq/remotes13d716292c62/zdk123-SpiecEasi-ff528b2/DESCRIPTION’ (742ms) ─ preparing ‘SpiecEasi’: ✓ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘SpiecEasi/inst’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘SpiecEasi_1.1.1.tar.gz’

mtva0001 commented 2 years ago

Have exactly the same issue. Any idea how to solve this?

zdk123 commented 2 years ago

libfortran is missing, maybe also gcc.

mtva0001 commented 2 years ago

Well, I'm not an IT guy so I don't know if there is a difference between libfortran and gfortran, but I followed the instructions above and installed successfully the gfortran on my Apple M1: gfortran --version GNU Fortran (GCC) 11.0.0 20201205 (experimental)

Try to use your software in R, by the way.

zdk123 commented 2 years ago

might be a problem with linking fortran from a package manager such as homebrew. See https://mac.r-project.org/tools/

sylsyltong commented 2 years ago

Hello, I apologise if this has been asked already, but I'm having similar troubles. I have a M1 Macbook running 11.2 Big Sur, and am using RStudio 1.4.1717 with R version 4.1.2.

I've reinstalled R, Rstudio, xcode. I have also downloaded gfortran and moved it to whatever path R asked for (sudo mv Downloads/gfortran /opt/R/arm64/), which resolved an error code to do with gfortran's location. Oh and I've also tried running Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true") suggested previously and the error persists.

Would be really grateful for any information or just more things I could try. Thank you!

library(devtools) Loading required package: usethis install_github("zdk123/SpiecEasi") Downloading GitHub repo zdk123/SpiecEasi@HEAD ✓ checking for file ‘/private/var/folders/0l/8f07mtf15ln89vh913qlds3r0000gn/T/Rtmps5Q0Tj/remotes150b792f90c3/zdk123-SpiecEasi-c463727/DESCRIPTION’ ... ─ preparing ‘SpiecEasi’: ✓ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘SpiecEasi/inst’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘SpiecEasi_1.1.2.tar.gz’

bobthacker commented 2 years ago

I have a similar issue installing on mac OS 12.2.1, Intel chip, R 4.1.3 I tried the conda suggestions above and the modification to ignore warnings, and tried multiple versions of gfortran.

The error message from install.packages from conda occurs when the library is requested, not during install.packages. Error: package or namespace load failed for ‘SpiecEasi’ in library.dynam(lib, package, package.lib): shared object ‘SpiecEasi.so’ not found

The error message from install_github is: ld: warning: dylib (/usr/local/gfortran/lib/libquadmath.dylib) was built for newer macOS version (10.14) than being linked (10.13) ld: malformed universal file: slice content is not mach-o or a static library file '/usr/local/lib/libgfortran.dylib' clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [SpiecEasi.so] Error 1 ERROR: compilation failed for package ‘SpiecEasi’

Unfortunately, https://github.com/fxcoudert/gfortran-for-macOS/releases?page=1 does not include the 10.13 version of gfortran

Any suggestions?