Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renv::snapshot() not working and returning an error #2110

Open
mlp130 opened this issue Mar 12, 2025 · 8 comments
Open

renv::snapshot() not working and returning an error #2110

mlp130 opened this issue Mar 12, 2025 · 8 comments

Comments

@mlp130
Copy link

mlp130 commented Mar 12, 2025

This was not always the case for this project, but when I run renv::snapshot(), it immediately returns the following error:

Error in if (package == "R") return() :
missing value where TRUE/FALSE needed

Traceback (most recent calls last):
9: renv::snapshot()
8: alt <- new <- renv_lockfile_create(
project = project,
type = type,
libpaths = libpaths,
packages = packages,
exclude = exclude,
prompt = prompt,
force = force,
dev = dev
) at snapshot.R#179
7: lockfile <- withRestarts(
renv_lockfile_create_impl(project, type, libpaths, packages, exclude, prompt, force, dev = dev),
renv_recompute_records = function() {
renv_dynamic_reset()
renv_lockfile_create_impl(project, type, libpaths, packages, exclude, prompt, force, dev = dev)
}
) at lockfile.R#181
6: withOneRestart(expr, restarts[[1L]])
5: doWithOneRestart(return(expr), restart)
4: lockfile <- withRestarts(
renv_lockfile_create_impl(project, type, libpaths, packages, exclude, prompt, force, dev = dev),
renv_recompute_records = function() {
renv_dynamic_reset()
renv_lockfile_create_impl(project, type, libpaths, packages, exclude, prompt, force, dev = dev)
}
) at lockfile.R#181
3: records <- renv_snapshot_packages(
packages = setdiff(packages, exclude),
libpaths = libpaths,
project = project
) at lockfile.R#202
2: paths <- renv_package_dependencies(
packages = packages,
libpaths = libpaths,
callback = callback,
project = project
) at snapshot.R#1176
1: for (package in packages)
renv_package_dependencies_impl(package, visited, libpaths, fields, callback, project) at package.R#292

@kevinushey
Copy link
Collaborator

Can you provide the output of renv::diagnostics()? Any chance you can share a reproducible example or something similar?

@mlp130
Copy link
Author

mlp130 commented Mar 12, 2025

This is the most notable part of the renv::diagnostics() output that is different from my other projects that are working:

Image

@mlp130
Copy link
Author

mlp130 commented Mar 12, 2025

Also, whenever I enter the project, I usually get two of these warning messages after renv activates. After running diagnostic, it's giving it 4 times. Not sure if that helps at all (doesn't give this warning for any other project of mine)

Image

@kevinushey
Copy link
Collaborator

... why not just share the whole report?

@mlp130
Copy link
Author

mlp130 commented Mar 12, 2025

Diagnostics Report [renv 1.1.2]

/etc/lsb-release -----------------------------------------------------------

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

/etc/os-release ------------------------------------------------------------

PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Session Info ---------------------------------------------------------------

R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0

locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats graphics grDevices datasets utils methods base

loaded via a namespace (and not attached):
[1] compiler_4.3.3 tools_4.3.3 renv_1.1.2

Project --------------------------------------------------------------------

Project path: "~/repos/advance42"

Status ---------------------------------------------------------------------

The following package(s) are out of sync [lockfile != library]:

CRAN -----------------------------------------------------------------------

  • httr2 [1.1.0 != 1.1.1]

See ?renv::status for advice on resolving these issues.

Packages -------------------------------------------------------------------

Traceback (most recent calls last):
4: renv::diagnostics()
3: tryCatch(reporter(project), error = renv_error_handler)
2: tryCatchList(expr, classes, parentenv, handlers)
1: tryCatchOne(expr, names, parentenv, handlers[[1L]])

R System Requirements ------------------------------------------------------

Traceback (most recent calls last):
4: renv::diagnostics()
3: tryCatch(reporter(project), error = renv_error_handler)
2: tryCatchList(expr, classes, parentenv, handlers)
1: tryCatchOne(expr, names, parentenv, handlers[[1L]])

ABI ------------------------------------------------------------------------

The following packages were built against a newer version of Rcpp than is currently available:

  • spatialinference 1.0.6
    These packages depend on Rcpp (>= 1.0.7); however, Rcpp 1.0.14 is currently installed.
    Consider installing a new version of Rcpp with 'install.packages("Rcpp")'.

User Profile ---------------------------------------------------------------

[1] Source Package Require Version Dev
<0 rows> (or 0-length row.names)

Settings -------------------------------------------------------------------

List of 13
$ bioconductor.version : chr(0)
$ external.libraries : chr(0)
$ ignored.packages : chr [1:2] "advance42" "pak"
$ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
$ ppm.enabled : NULL
$ ppm.ignored.urls : chr(0)
$ r.version : chr(0)
$ snapshot.type : chr "implicit"
$ use.cache : logi FALSE
$ vcs.ignore.cellar : logi TRUE
$ vcs.ignore.library : logi TRUE
$ vcs.ignore.local : logi TRUE
$ vcs.manage.ignores : logi TRUE

Options --------------------------------------------------------------------

List of 12
$ defaultPackages : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
$ download.file.method : NULL
$ download.file.extra : NULL
$ install.packages.compile.from.source: NULL
$ pkgType : chr "source"
$ repos : Named chr [1:2] "https://packagemanager.posit.co/cran/latest" "https://internalcran.com"
..- attr(*, "names")= chr [1:2] "CRAN" "internalCRAN"
$ renv.consent : logi TRUE
$ renv.project.path : chr "/home/ubuntu/repos/advance42"
$ renv.config.install.transactional : logi FALSE
$ renv.config.sandbox.enabled : logi FALSE
$ renv.config.pak.enabled : logi TRUE
$ renv.verbose : logi TRUE

Environment Variables ------------------------------------------------------

HOME = /home/ubuntu
LANG = C.UTF-8
MAKE = make
R_LIBS =
R_LIBS_SITE = /usr/local/lib/R/site-library/:/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
R_LIBS_USER = /home/ubuntu/repos/advance42/renv/library/R-4.3/x86_64-pc-linux-gnu
RENV_DEFAULT_R_ENVIRON =
RENV_DEFAULT_R_ENVIRON_USER =
RENV_DEFAULT_R_LIBS =
RENV_DEFAULT_R_LIBS_SITE = /usr/local/lib/R/site-library/:/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
RENV_DEFAULT_R_LIBS_USER = /home/ubuntu/R/x86_64-pc-linux-gnu-library/4.3
RENV_DEFAULT_R_PROFILE =
RENV_DEFAULT_R_PROFILE_USER =
RENV_PROJECT = /home/ubuntu/repos/advance42

PATH -----------------------------------------------------------------------

  • /home/ubuntu/.local/bin
  • /home/ubuntu/.pyenv/shims
  • /home/ubuntu/.vscode-server/cli/servers/Stable-6609ac3d66f4eade5cf376d1cb76f13985724bcb/server/bin/remote-cli
  • /home/ubuntu/.pyenv/bin
  • /usr/local/sbin
  • /usr/local/bin
  • /usr/sbin
  • /usr/bin
  • /sbin
  • /bin
  • /usr/games
  • /usr/local/games
  • /snap/bin
  • /home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.4.1-linux-x64/bundled/scripts/noConfigScripts

Cache ----------------------------------------------------------------------

There are a total of 265 packages installed in the renv cache.
Cache path: "~/.cache/R/renv/cache/v5/R-4.3/x86_64-pc-linux-gnu"

@kevinushey
Copy link
Collaborator

Does your project contain R Markdown files or Quarto Markdown files with custom chunk headers? The warnings printed would suggest you have some labels which aren't plain strings; rather, they're character vectors or something else.

Most likely, there's a file in your project that's tripping up renv::dependencies() in an unexpected way.

@kevinushey
Copy link
Collaborator

I have a potential fix / workaround for this in the development version of renv. You can try installing it with:

renv::install("rstudio/renv")

Can you give this a try and let me know if the issue persists?

@mlp130
Copy link
Author

mlp130 commented Mar 13, 2025

I do have a lot of .Rnw files with those. My other projects have this as well though, so maybe there's something off about one of them.

I tried running snapshot again after downloading the development version, but got the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants