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

compatibility with renv #51

Open
julou opened this issue Jul 2, 2020 · 10 comments
Open

compatibility with renv #51

julou opened this issue Jul 2, 2020 · 10 comments

Comments

@julou
Copy link

julou commented Jul 2, 2020

hi @karthik, thanks for the great package! I'm trying it out and expect tight integration with renv.

Now on R-4.0.1 but R version "discovery" is based on date and seems not to have been updated :-/
You wrote on #45 that you would do it in the same day (Apr 9th but the last date in this table is Feb 29th 😅). So I guess a project using the most version of R at any time would work fine once this is fixed.

But integration with renv would require reading the R version from renv.lock, no?

@karthik
Copy link
Owner

karthik commented Jul 2, 2020

Yes apologies julou. While I was making that fix the same day, an update to usethis broke a core functionality. I am close to making that fix (and also merging in a couple of Prs). I'll follow up fairly soon.

@karthik
Copy link
Owner

karthik commented Jul 2, 2020

But integration with renv would require reading the R version from renv.lock, no?

Not necessarily but I will document this.

@julou
Copy link
Author

julou commented Jul 3, 2020

Alright… I'm holding my breath!
For the moment, my first steps with holepunch are unfortunately a rather sobering experience :-/ (had to downgrade usethis, got a cryptic error message when calling write_dockerfile() before having created a remote on GitHub for the project, got a different R version used in the Docker container)

@julou julou changed the title read R version from renv compatibility with renv Jul 3, 2020
@julou
Copy link
Author

julou commented Jul 3, 2020

I spent more time trying to get a working binder instance for a project with renv using holepunch. It seems that this is either poorly supported or it would deserve more documentation ;)

The sort of workflow I imagine is to work locally (on my laptop / using my account at our HPC facility), documenting the execution environment using renv and tracking changes with git.
At the time a project is wrapped up, I would like to be able to create a binder instance from the corresponding GitHub repository. i.e. call holepunch's write_compendium_description(), write_dockerfile() , and build_binder().
Maybe this is where I'm mistaken in the first place and this is not a canonical workflow to use this tool.

In this mindset, I expect holepunch to read the version of R and packages from renv.lock. As explained above, this is not the case.

After banging my head on many walls*, I finally managed to start binder for a repository under R 3.6.3 using the workflow mentioned above. However, I now have the following bug after starting R:

Successfully installed and loaded renv 0.10.0.
(...)
> options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2020-07-03/')); devtools::install_deps()
Error in loadNamespace(name) : there is no package called ‘devtools’

I suspect that this comes from the fact that this rsession is now using renv (for which devtools is not installed). Hence the call to devtools used in the Dockerfile raising an error.

So I wonder if it's possible at all to use holepunch with renv…

Along the same line, it seems to me that packages should not be added to the description file when renv is used (since the whole package management should be transferred to renv), which seem to indicate there is little if any integration between holepunch and renv. But maybe this is only my lack of understanding of these tools are supposed to play together (then pointing me to documentation would be helpful indeed).


* I stumbled upon the following issues one after the other:

  • rocker/binder not having an image for 4.0.1
  • rocker/binder having useless bugged images for 4.0.0 and 4.0.2
  • the current version of holepunch requiring to downgrade usethis to 1.5.1
  • rocker/binder/3.6.3 requiring to downgrade renv to 0.10

@julou
Copy link
Author

julou commented Jul 3, 2020

For the moment, I can get a binder instance doing what I need by editing the Dockerfile.
This allows to use packages as specified in renv.lock and to restore them efficiently using binaries from RStudio package repository.

RUN wget https://github.com/julou/BinderWithR/raw/R-3.6/DESCRIPTION && R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2020-07-03/')); devtools::install_deps()"

replaced by

RUN wget https://github.com/julou/BinderWithR/raw/R-3.6/DESCRIPTION && R -e "renv::restore(repos = c(CRAN='https://packagemanager.rstudio.com/all/__linux__/bionic/298'))"

@karthik
Copy link
Owner

karthik commented Aug 27, 2020

My apologies @julou
It's been a really busy year. I've finally fixed these issues without having to downgrade usethis. The tests still need updating but it does work now. Issues or questions welcome.

@karthik
Copy link
Owner

karthik commented Aug 27, 2020

But yes the rocker/binder issues remain.

@ivan-paleo
Copy link

ivan-paleo commented Nov 20, 2020

I have created a new issue on the renv GitHub, but maybe it is due to holepunch instead:
rstudio/renv#575

Apparently, citing @kevinushey:

The problem here is that renv is not installed in the project library, and so renv is trying to install itself from the declared package repositories. Unfortunately, renv 0.12.2 isn't actually available from the older MRAN snapshot you've set.
The fix here would be to ensure that renv is installed from CRAN as opposed to an older MRAN snapshot.
Unfortunately I'm not sure [how] -- I presume that would need to be configured on the holepunch side somewhere.

Any help would be appreciated

benmarwick pushed a commit to cylerc/14C_Antiquity that referenced this issue Sep 9, 2021
@palermog
Copy link

palermog commented Apr 8, 2023

@ivan-paleo Are you still having this issue? I've run into it as well.

@ivan-paleo
Copy link

@palermog I think I don't have the issue anymore but I'm not quite sure because I still haven't managed to make holepunch work: every time I solve an issue, another one pops up... I think it is rather due to another issue. I'll try again for my next project, but until now, I've done without holepunch and without docker...

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