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

Is there an option of warning-continue instead of error-exit on init failure? #487

Closed
OmaymaS opened this issue Jul 20, 2020 · 7 comments
Closed

Comments

@OmaymaS
Copy link

OmaymaS commented Jul 20, 2020

I checked the previous issues but I didn't find a related one, please refer me to any relevant ones if exist.

I was wondering if there's any option with init()to set in order to make it possible to skip errors while installing packages specified in renv.lock. What I am looking for is an option so that whenever it fails to install a package, it should try the next one till the end and then provide a log of the failed attempts. Is there any possibility? And what would be the cons of it?

Thanks

@kevinushey
Copy link
Collaborator

Just for clarity, you're calling renv::init() on a project that already contains a lockfile? (That is, what is happening in effect is an renv::restore() behind the scenes)

This isn't currently possible, but seems like it would be worth implementing.

As an aside, you could also use renv::activate() to activate renv for a project without explicitly restoring the project library.

@OmaymaS
Copy link
Author

OmaymaS commented Jul 21, 2020

Just for clarity, you're calling renv::init() on a project that already contains a lockfile? (That is, what is happening in effect is an renv::restore() behind the scenes)

What I wanted to do is to keep a lockfile in the Github repo, so others could clone the repo and install the same packages. Now I get that I should also commit renv/activate.R and let others use renv::restore(). But I assume they will probably get the same issue on any package installation failure.

@OmaymaS OmaymaS changed the title Is there an option of warning-continue instead error-exit on init failure? Is there an option of warning-continue instead of error-exit on init failure? Jul 21, 2020
@kevinushey
Copy link
Collaborator

Still though, won't that be an issue for other users down the line? If they're unable to install packages required by a particular project, then they're unlikely to be able to run scripts in that project. Or are these packages optional, or used only in separate circumstances?

@karawoo
Copy link

karawoo commented Aug 26, 2020

I have wished for this feature as well. I'll sometimes run into difficulties restoring from a lockfile (I think normally due to issues installing older versions of packages from source). If I need to work on part of the project that doesn't use all the dependencies it'd be nice to restore everything else, and leave dealing with the unsuccessful dependencies for later.

@kevinushey
Copy link
Collaborator

While this isn't a perfect fix, you should be able to do something like:

renv::restore(packages = c(...))

to restore a subset of packages from a lockfile (+ that package's dependencies). Note that renv will only notify you about the package you've requested (which I should try to fix eventually) but you will see all dependent packages restored. For example:

> renv::restore(packages = "rmarkdown")
The following package(s) will be updated:

# CRAN ===============================
- rmarkdown   [* -> 2.3]

Do you want to proceed? [y/N]: y
Installing evaluate [0.14] ...
        OK (linked cache)
Installing highr [0.8] ...
        OK (linked cache)
Installing xfun [0.16] ...
        OK (linked cache)
Installing mime [0.9] ...
        OK (linked cache)
Installing markdown [1.1] ...
        OK (linked cache)
Installing glue [1.4.1] ...
        OK (linked cache)
Installing magrittr [1.5] ...
        OK (linked cache)
Installing stringi [1.4.6] ...
        OK (linked cache)
Installing stringr [1.4.0] ...
        OK (linked cache)
Installing yaml [2.2.1] ...
        OK (linked cache)
Installing knitr [1.29] ...
        OK (linked cache)
Installing digest [0.6.25] ...
        OK (linked cache)
Installing base64enc [0.1-3] ...
        OK (linked cache)
Installing rlang [0.4.7] ...
        OK (linked cache)
Installing htmltools [0.5.0] ...
        OK (linked cache)
Installing jsonlite [1.7.0] ...
        OK (linked cache)
Installing tinytex [0.25] ...
        OK (linked cache)
Installing rmarkdown [2.3] ...
        OK (linked cache)

@karawoo
Copy link

karawoo commented Aug 27, 2020

Oh nice, I didn't know that

@hadley
Copy link
Member

hadley commented Apr 28, 2023

I think this is now a duplicate of #1109

@hadley hadley closed this as completed Apr 28, 2023
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