Open klmr opened 5 days ago
I suspect that renv::upgrade() launches a subprocess which doesn’t inherit the options of the parent R process. In fact, using the environment variable RENV_CONFIG_AUTOLOADER_ENABLED instead of the option works around this issue.
That's exactly correct -- I'll see if we can forward the option in this case.
The documentation for
renv.config.autoloader.enabled
says:However,
renv::upgrade()
does not honour this promise:This outputs:
In other words:
renv::init()
behaved correctly, butrenv::upgrade()
did not.I suspect that
renv::upgrade()
launches a subprocess which doesn’t inherit the options of the parent R process. In fact, using the environment variableRENV_CONFIG_AUTOLOADER_ENABLED
instead of the option works around this issue.Added context: I am using the ‘rprofile’ package. This package takes care of loading ‘renv’ inside the project
.Rprofile
file, amongst other things. As a consequence,source("renv/activate.R")
should not be added to.Rprofile
. ‘rprofile’ suppresses this by setting the aforementioned option. As a consequence of how ‘rprofile’ works, it is installed in the user (or system) package library, not in the ‘renv’ project library. As a consequence, its loading seems to be skipped in the subprocess launched byrenv::upgrade()
. In itself, this is fine: in fact, ‘rprofile’ is designed to be loaded viatry(rprofile::load())
inside.Rprofile
to avoid breaking when it is not installed.