rlang version conflict in jupyter notebook with renv

Following the "If it hasn’t, please feel free to either ask on the RStudio Community forums." link on https://rdrr.io/cran/devtools/man/reload.html

I load renv the following way in jupyter notebok (IRkernel is installed in the system R):

Then I get the following error loading tidyverse:
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.9 is required

And indeed, rlang version in the system R is:
> packageVersion("rlang")
[1] ‘0.4.7’

while renv has a newer version and loads tidyverse just fine:
> packageVersion("rlang")
[1] ‘0.4.10’
> library(tidyverse)
── Attaching packages ...

It looks like IRkernel loads rlang-0.4.7 before renv kicks in and I can't find a way force it to reload rlang. This fails, for example:
detach("package:rlang", character.only = TRUE, unload = TRUE)
Error in detach("package:rlang", character.only = TRUE, unload = TRUE): invalid 'name' argument

Jupyter itself is installed into a virtualenv. What I'm trying to achieve is to have a dedicated virtualenv and renv per project and access both from jupyter notebook.

Obvious workaround is to upgrade the system rlang, but this may break reproducibility of older projects, assuming I have any.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.