Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMINC is not being installed #25

Closed
bcdarwin opened this issue Sep 13, 2018 · 23 comments
Closed

RMINC is not being installed #25

bcdarwin opened this issue Sep 13, 2018 · 23 comments

Comments

@bcdarwin
Copy link
Contributor

bcdarwin commented Sep 13, 2018

as it's not available via https://cloud.r-project.org/ and so this code fails silently.

@gdevenyi
Copy link
Member

What's the right way to do this properly?

R is just an admin's nightmare at getting things properly installed.

@bcdarwin
Copy link
Contributor Author

@cfhammill ?

@cfhammill
Copy link

devtools::install_github("Mouse-Imaging-Centre/RMINC")

@gdevenyi
Copy link
Member

That will not install dependencies.

@cfhammill
Copy link

yes it will. For some reason lmerTest gets left behind, but I think that can be fixed with:

devtools::install_github("Mouse-Imaging-Centre/RMINC"
  , dependencies = c("Suggests", "Imports", "Depends", "LinkingTo"))

@gdevenyi
Copy link
Member

Okay, so we're back to what I'm doing, that's equivalent to dependencies=TRUE.

It seems it doesn't accept the "repo =" option, even though the docs say that will be passed forward into the install command.

I'm now testing a version where I set the global R repo option instead.

@gdevenyi
Copy link
Member

As a side question, how the heck do I force R to error on any failure, instead of continuing on in the script, making debugging incredibly difficult?

@bcdarwin
Copy link
Contributor Author

I think using Rscript instead of R will work this way.

@hrallapalli-zz
Copy link

@cfhammill
Copy link

RMINC has to come from github, it's not on CRAN. That's why that is failing. Dependencies = TRUE is the default as far as I know, you really need the "Suggests"

@cfhammill
Copy link

And yeah, don't use R, use Rscript -e, you're opening R in interactive mode which doesn't bubble errors to end the program.

@gdevenyi
Copy link
Member

The original line of code is using install_url pointing to the release tarball on github.

I think the main issue here is that the R script always succeeds and never stops on error so I don't even know it went wrong.

I'll try Rscript -e

@gdevenyi
Copy link
Member

Current failure mode:

    mincvm-virtualbox: Downloading package from url: https://github.com/Mouse-Imaging-Centre/RMINC/releases/download/v1.5.2.0/RMINC_1.5.2.0.tar.gz
    mincvm-virtualbox: Installation failed: error setting certificate verify locations:
    mincvm-virtualbox:   CAfile: microsoft-r-cacert.pem
    mincvm-virtualbox:   CApath: none
    mincvm-virtualbox: Downloading package from url: https://github.com/BIC-MNI/mni.cortical.statistics/archive/ver-0_9_5.tar.gz
    mincvm-virtualbox: Installation failed: error setting certificate verify locations:
    mincvm-virtualbox:   CAfile: microsoft-r-cacert.pem
    mincvm-virtualbox:   CApath: none

And Rscript happily continues on, and exits successfully. So, again I have a VM build without RMINC.

@cfhammill
Copy link

cfhammill commented Sep 13, 2018

Well that's a pain, devtools doesn't throw an error when install fails (we're all learning together), so you need to wrap it:

r <- devtools::install_github(...)
if(!r) stop("RMINC installed failed, drat")

@bcdarwin
Copy link
Contributor Author

Worth a bug report to devtools?

@cfhammill
Copy link

Ehhh, returning the success state of the install is valid. I wonder if it has a strictness argument...

@gdevenyi
Copy link
Member

After much hackery, it finally works and builds again.

Still doesn't throw errors when R goes bad, even after wrapping things and upgrading warnings to errors. I'll just have to be very careful reading the logs.

@cfhammill
Copy link

https://github.com/CobraLab/MINC-VM/blob/master/provision.sh#L165

This isn't quite right I don't think. It doesn't throw a warning when it fails, it just returns FALSE. You need to translate that into an error:

stopifnot(
  install_url("$RMINC", dependencies=TRUE, upgrade_dependencies=FALSE)
)

or if you want a more descriptive error

r <- install_url("$RMINC", dependencies=TRUE, upgrade_dependencies=FALSE)
if(!r) stop("Failed to install RMINC")

@gdevenyi
Copy link
Member

I based the wrapping on https://stackoverflow.com/a/26245048/4130016.

Maybe I should wrap that again with stopifnot as well?

@cfhammill
Copy link

that is for install.packages which does throw warnings, devtools::install* does not. Really all you need is the code I posted above, no handlers necessary.

That SO answer is bad for other reasons too, tryCatch solves the problem more cleanly.

@gdevenyi
Copy link
Member

Am I doing something wrong?

cat <<-EOF | Rscript --vanilla -
r = getOption("repos") 
r["CRAN"] = 'http://cloud.r-project.org/'
options(repos = r)
rm(r)
library(devtools)
stopifnot((install_url("$RMINC", dependencies=TRUE, upgrade_dependencies=FALSE))
stopifnot((install_url("$mni_cortical_statistics", dependencies=TRUE, upgrade_dependencies=FALSE))
EOF
    mincvm-virtualbox: Error: unexpected symbol in:
    mincvm-virtualbox: "stopifnot((install_url("https://github.com/Mouse-Imaging-Centre/RMINC/releases/download/v1.5.2.0/RMINC_1.5.2.0.tar.gz", dependencies=TRUE, upgrade_dependencies=FALSE))
    mincvm-virtualbox: stopifnot"

@gdevenyi
Copy link
Member

nevermind... unbalanced parenthesis...

@cfhammill
Copy link

cfhammill commented Sep 17, 2018

that's usually the source of unexpected symbol, pleased it's working now 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants