-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Description
We have discovered a bug in renv::init() of [email protected] or a change in expected behvior from [email protected] for a specific set of circumstances.
- A package is installed in the User (or System) Library
- The same package is not in the
renvcache.
It appears that hydrate() in [email protected] is not properly linking packages into the project library. init() and hydrate() do not show any errors or warnings. This change in behavior happened between 1.0.11 and 1.1.0.
Reprex:
Start with an empty project. WIth one source file.
## source.R
library(dplyr)To show what is expected behavior, let's use [email protected]
install.packages("remotes")
remotes::install_version("renv", version = "1.0.11")
.rs.restartR()
# Ensure that `dplyr` is in the User (or System) Library
install.packages("dplyr")
# Clear `dplyr` from renv cache
renv::purge("dplyr")
renv::init()
renv::status()
# No issues foundNow, we reset our project to its original pre-renv state.
renv::deactivate()
unlink("renv", recursive = TRUE)
file.remove("renv.lock")
.rs.restartR()
renv::purge("dplyr")Then we install the latest renv and initialize.
install.packages("renv")
packageVersion("renv")
# [1] ‘1.1.2’
renv::init()
renv::status()
# The following package(s) are used in this project, but are not installed:
# - dplyrhydrate() is not working as it used to
# renv 1.0.11
> renv::purge("dplyr")
The following packages will be purged from the cache:
- dplyr 1.1.4 [Hash: fedd9d00c2944ff00a0e2696ccf048ec]
Do you want to proceed? [Y/n]: y
- Removed 1 package from the cache.
> renv::hydrate()
The following packages were discovered:
# ~/Library/R/arm64/4.4/library ----------------------------------------------
- dplyr 1.1.4
They will be linked into the project library.
Do you want to proceed? [Y/n]: y
- Linking packages into the project library ... Done!
- Hydrated 1 packages in 53 milliseconds.
> renv::status()
No issues found -- the project is in a consistent state.# renv 1.1.2
> renv::hydrate()
The following packages were discovered:
# ~/Library/R/arm64/4.4/library ----------------------------------------------
- dplyr 1.1.4
They will be linked into the project library.
Do you want to proceed? [Y/n]: y
- Linking packages into the project library ... Done!
- Hydrated 1 packages in 3 milliseconds.
> renv::status()
The following package(s) are used in this project, but are not installed:
- dplyr
See `?renv::status` for advice on resolving these issues.We took a look inside hydrate() and further into renv_hydrate_link_packages() and found the following difference:
# renv 1.0.11
Browse[1]> cached
$dplyr
[1] TRUE
# renv 1.1.2
Browse[1]> cached
$dplyr
[1] FALSEMetadata
Metadata
Assignees
Labels
No labels