GithubHelp home page GithubHelp logo

Comments (23)

gdevenyi avatar gdevenyi commented on July 27, 2024

What's the right way to do this properly?

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

from minc-vm.

bcdarwin avatar bcdarwin commented on July 27, 2024

@cfhammill ?

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

That will not install dependencies.

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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"))

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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.

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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?

from minc-vm.

bcdarwin avatar bcdarwin commented on July 27, 2024

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

from minc-vm.

hrallapalli-zz avatar hrallapalli-zz commented on July 27, 2024

https://support.rstudio.com/hc/en-us/articles/200713843?version=1.0.153&mode=desktop#stopping-when-an-error-occurs

options(error = browser())

Is this helpful?

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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"

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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.

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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.

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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")

from minc-vm.

bcdarwin avatar bcdarwin commented on July 27, 2024

Worth a bug report to devtools?

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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.

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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")

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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

Maybe I should wrap that again with stopifnot as well?

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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.

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

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"

from minc-vm.

gdevenyi avatar gdevenyi commented on July 27, 2024

nevermind... unbalanced parenthesis...

from minc-vm.

cfhammill avatar cfhammill commented on July 27, 2024

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

from minc-vm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.