rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
980 stars 153 forks source link

Inconsistency in dependencies discovery timing. #1919

Open nirguk opened 4 weeks ago

nirguk commented 4 weeks ago

In a particular project with many files; I do indeed use .renvignore and .gitignore to reduce the dependency detection timings. My issue is that when R is up and running as per normal. renv::dependencies() reliably computes in a perfectly fast 0.07seconds +/- 0.01 seconds, and renv::load() takes a longer but perfectly respectable 1second. However quite often, when I perform a R session restart through RStudio IDE, the time to restart seems to take unusually long, and I am met with a corresponding message of the type :

- Project '~/nirprojects/Lumos' loaded. [renv 1.0.7]

NOTE: Dependency discovery took 10 seconds during snapshot.
Consider using .renvignore to ignore files, or switching to explicit snapshots.
See `?renv::dependencies` for more information.

but I'm having difficulty reconciling the slow dependency discover on restart, with the otherwise fast dependency discovery on 'awake' sessions shall we say; are there any theories as to why this might be and what I could explore ? Could this be a quirk of the renv/activate process ?

nirguk commented 4 weeks ago

as a further clue about what might be happening above; I resolved my issue by adding explicit DESCRIPTION file; though its unclear to me why this might be of more benefit on a restart than when running dependencies() or load() in a 'warmed up' session

kevinushey commented 4 weeks ago

NOTE: Dependency discovery took 10 seconds during snapshot.

The fact that this is taking exactly 10 seconds makes me wonder if it's related to the renv watchdog process. Does the issue alleviate if you use:

RENV_WATCHDOG_ENABLED = FALSE

in your project .Renviron?