epiverse-trace / episoap

[Not published - under active development] A Store of Outbreak Analytics Pipelines Provided as Rmarkdown Report Templates
https://epiverse-trace.github.io/episoap/
Other
4 stars 2 forks source link

{renv} integration (user experience on system requiring source packages) #97

Open TimTaylor opened 1 year ago

TimTaylor commented 1 year ago

I've just installed {episoap} and have tried running the transmissibility pipeline. After a long time in the [lockfile] section of rendering (I'm on Fedora so I'm assuming it is installing every package from source) the report will eventually error out. The reason:

Error:
! install of package 'sodium' failed [error code 1] 

Unfortunately there is no additional information and the backtrace displayed by default is helpful. I know this is due to system dependencies and if I were to attempt to install directly I would get the following, more helpful, message:

--------------------------- [ANTICONF] --------------------------------
Configuration failed because libsodium was not found. Try installing:
 * deb: libsodium-dev (Debian, Ubuntu, etc)
 * rpm: libsodium-devel (Fedora, EPEL)
 * csw: libsodium_dev (Solaris)
 * brew: libsodium (OSX)

This leads me to the following possible issues:

Hope this all makes sense and a lot probably just boils down to documentation.

Bisaloo commented 1 year ago

Thanks for the feedback!

Here is an attempt at separating what can be done on our side vs what needs to be fixed / is currently being improved upstream in renv.

renv limitations

I'm not sure if there is anyway to bubble up {renv} progress when rendering a report (so people do not think it is broken).

This is a good suggestion but I don't think there is any way to make renv display progress at the moment. This may come once integration with pak is complete (https://github.com/rstudio/renv/issues/620).

I assume the slowness is only on the first run of the report not subsequent as the libraries are cached???

Yes. Once integration with pak is complete, my understanding is that it will also be able to copy already installed packages from your standard package library, which should speed things up for most users.

Additionally, with the next renv version, Posit Public Package Manager will be used by default to download pre-compiled binaries when the user didn't override the default repositories with options().

Possible actions from episoap side

It would be good if the "Configuration failed" message was bubbled up in the output. I'm not sure if this is an {renv} or {rmarkdown} rendering issue?

My understanding is that renv will silence installation output by default, which is why you only see a boilerplate message (generated by renv:::r_exec_error()). You can change this by changing the value of renv.config.install.verbose to TRUE.

https://rstudio.github.io/renv/reference/config.html#renv-config-install-verbose

Is this something we should enable by default by shipping an .Rprofile with the pipelines? I'm concerned it would move even further of in the direction of interfering with the user custom settings.

Alternatively, it could be set in the Rmd report if not already set to a different value. But I'm afraid we're starting to overengineer this.

Generally, perhaps there needs to be more documentation on the use of {renv} and what this entails. E.g. An additional 250mb of packages were downloaded/installed in .cache upon rendering the report.

Yes, documentation could be useful but it also suggests we might need to trim down dependencies.