carissalow / rapids

Reproducible Analysis Pipeline for Data Streams
http://www.rapids.science/
GNU Affero General Public License v3.0
37 stars 20 forks source link

Error while installing R packages and virtual environment on MacBook M1 #224

Open AnasKhann22 opened 1 year ago

AnasKhann22 commented 1 year ago

While installing the RAPIDs on my MacBook M1 2020, at Step 7 which is "Install R packages and virtual environment:" and while executing "snakemake -j1 renv_restore", I am getting below error on the terminal:

Shutting down, this might take some time. Exiting because a job execution failed. Look above for error message Complete log: /Users/anaskhan/Documents/PhD/My Research/Data/rapids/.snakemake/log/2023-08-22T105348.044124.snakemake.log

jenniferfedor commented 1 year ago

Hi @AnasKhann22, thank you for using RAPIDS and reporting this issue! In our lock file, we request that renv install packages from CRAN, but it looks like renv is attempting to install packages from the Microsoft R Application Network (MRAN) here. MRAN was retired on July 1, 2023 and is no longer accessible.


In your copy of rapids, could you please try:

  1. Adding the following line to .Rprofile:

    options(renv.config.mran.enabled = FALSE)
  2. Changing line 19 of rules/renv.smk to the following:

    "R -e 'renv::restore(repos = c(CRAN = \"https://cloud.r-project.org\"))'"


And let us know if that solves the issue?

Could you please also let us know what versions of macOS and R you are using? Unfortunately I was not able to reproduce this particular error, but I am using an Intel MacBook (running macOS Monterey 12.4 and R 4.2.3). Also please note that on M1 chip Macs, R should be installed via brew under Rosetta (x86 arch) due to incompatibility issues with some of the libraries RAPIDS uses (see the "M1 Macs" dropdown under the MacOS tab of our installation instructions and this section of our documentation). Thank you!

AnasKhann22 commented 12 months ago

Hi @jenniferfedor , Thanks for your reply. After following the above mentioned steps, I'm getting another error now on the same step "snakemake -j1 renv_restore".

R was unable to find one or more FORTRAN libraries during compilation.
This often implies that the FORTRAN compiler has not been properly configured.
Please see https://stackoverflow.com/q/35999874 for more information.

Reason(s):
- 'ld: library not found for -lgfortran'
Error: install of package 'KernSmooth' failed
Traceback (most recent calls last):
14: renv::restore(repos = c(CRAN = "https://cloud.r-project.org"))
13: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
12: renv_install(records, library)
11: renv_install_staged(records, library)
10: renv_install_default(records, library)
 9: handler(package, renv_install_impl(record))
 8: renv_install_impl(record)
 7: withCallingHandlers(renv_install_package_local(record), error = function(e) {
        vwritef("\tFAILED")
        writef(e$output)
    })
 6: renv_install_package_local(record)
 5: renv_install_package_local_impl(package, path, library)
 4: r_cmd_install(package, path, library)
 3: r_exec(package, args, "install")
 2: r_exec_error(package, output, label)
 1: stop(error)
Execution halted
[Tue Aug 29 09:54:38 2023]
Error in rule renv_restore:
    jobid: 0
    shell:
        R -e 'renv::restore(repos = c(CRAN = "https://cloud.r-project.org"))'
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message

My R version is 4.0..0 and Mac OS is Ventura 13.0.

jenniferfedor commented 12 months ago

Hi @AnasKhann22, I'm glad to hear those steps worked. Thanks for letting us know.

It looks like you are either missing a dependency required to compile that package, or R doesn't know where to find it. I would recommend following the suggestions in the Stack Overflow post linked at the top of the error message (https://stackoverflow.com/q/35999874).

Please let us know if you encounter any other issues. Thank you!

jenniferfedor commented 11 months ago

Hi @AnasKhann22, just wanted to follow up about this. Were you able to resolve this issue? Thanks!

Sabit-Ahmed commented 11 months ago

Hi @jenniferfedor

I have faced similar issue in Mac M1 device. I have followed rosetta brew installation and the rapids documentation. I have got these error even I have followed your above modifications:

`rapids % snakemake -j1 renv_restore Building DAG of jobs... Using shell: /bin/bash Provided cores: 1 (use --cores to define parallelism) Rules claiming more threads will be scaled down. Job counts: count jobs 1 renv_restore 1

[Thu Sep 21 01:54:51 2023] rule renv_restore: jobid: 0

R version 4.3.1 (2023-06-16) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin22.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

CRAN ===============================

Shutting down, this might take some time. Exiting because a job execution failed. Look above for error message 2023-09-21T015451.394109.snakemake.log

`

jenniferfedor commented 11 months ago

Hi @Sabit-Ahmed, thanks for reporting! I see that you have R 4.3.1 installed. Unfortunately the RAPIDS R environment is not currently compatible with versions of R newer than 4.2. This particular error with the MASS package is caused by unknown type name Sint which was dropped in R 4.3 per the change log (page 9). Could you please try downgrading your R installation to version 4.2.3 and let us know if you continue to experience errors? Thank you!

jenniferfedor commented 11 months ago

Hi @Sabit-Ahmed, it looks like your follow-up question about downgrading was deleted, but in case it helps you or others, this post walks through the steps required to install older versions of Homebrew packages. They use terraform as an example but the steps should be applicable to any package.

Here is the link to the bottle for R 4.2.3: https://github.com/Homebrew/homebrew-core/commit/4afd43a67ddbf312ca21c6eb91e964fb8fbb1833

If you give this a try, please let us know how it goes and if it resolves the above issue. If so, we'll update our MacOS installation instructions. Thanks!

Sabit-Ahmed commented 11 months ago

Hi @jenniferfedor, thanks for your direction. I followed your guideline, but now getting new set of error.

`Building DAG of jobs... Using shell: /bin/bash Provided cores: 1 (use --cores to define parallelism) Rules claiming more threads will be scaled down. Job counts: count jobs 1 renv_restore 1

[Thu Sep 21 22:01:01 2023] rule renv_restore: jobid: 0

[Thu Sep 21 22:01:22 2023] Error in rule renv_restore: jobid: 0 shell: R -e 'renv::restore(repos = c(CRAN = "https://cloud.r-project.org"))' (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time. Exiting because a job execution failed. Look above for error message Complete log: /Users/userX/Desktop/Research/rapids/.snakemake/log/2023-09-21T220100.644673.snakemake.log `

jenniferfedor commented 11 months ago

Hi @Sabit-Ahmed, thank you for trying those steps and reporting back. I am not seeing an error message above that explains why this rule failed.

Can you please check that R 4.2.3 was installed successfully?

(base) ccupcilowlt02:~ jenniferfedor$ which R
/usr/local/bin/R
(base) ccupcilowlt02:~ jenniferfedor$ R

R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin21.6.0 (64-bit)


In the meantime, please feel free to use RAPIDS via our Docker container. Thanks!

Sabit-Ahmed commented 11 months ago

The version installed in my pc is 4.2.3. However, I have managed to work with the docker version of rapids. Thanks for the information.

(base) @SIE-GL41J2PQJK ~ % which R
/usr/local/bin/R
(base) @SIE-GL41J2PQJK ~ % R

R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin22.3.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.