rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1.02k stars 155 forks source link

Windows 10 project not activating #1922

Closed gjg525 closed 3 days ago

gjg525 commented 5 months ago

This is likely a question and not a bug. Any help would be much appreciated.

My issue is that I am trying to use renv projects others on my team have created or simply create my own project and renv doesn't ever seem to recognize that the project exists. A simple example is pasted below. The symptom of interest is that each call to snapshot or restore only ever responds with "It looks like you've called renv::snapshot() in a project that hasn't been activate yet." I can't seem to get past this infinite loop. In addition, if I use renv::install followed by status it says my project is up to date, but the lockfile never changes and only ever has renv recorded.

At one point I thought this was due to OneDrive and the backup behavior that creates a Documents folder at a different path, but now OneDrive sync, backup, is disabled for all of these folders and completely unliked and uninstalled.

Example - create a new folder C:/Users/gueng/Documents/renvTest

Restarting R session...

> renv::init()
The following package(s) will be updated in the lockfile:

# RSPM -----------------------------------------------------------------------
- renv   [* -> 1.0.7]

The version of R recorded in the lockfile will be updated:
- R      [* -> 4.4.0]

- Lockfile written to "~/renvTest/renv.lock".

Restarting R session...

> renv::snapshot()
It looks like you've called renv::snapshot() in a project that hasn't been activated yet.
How would you like to proceed? 

1: Activate the project and use the project library.
2: Do not activate the project and use the current library paths.
3: Cancel and resolve the situation another way.

Selection: 3
- Operation canceled.
> renv::install("dplyr")
The following package(s) will be installed:
- dplyr [1.1.4]
These packages will be installed into "C:/Users/gueng/AppData/Local/R/win-library/4.4".

Do you want to proceed? [Y/n]: Y

# Installing packages --------------------------------------------------------
- Installing dplyr ...                          OK [copied from cache in 0.25s]
Successfully installed 1 package in 0.3 seconds.
> renv::status()
No issues found -- the project is in a consistent state.
> renv::snapshot()
It looks like you've called renv::snapshot() in a project that hasn't been activated yet.
How would you like to proceed? 

1: Activate the project and use the project library.
2: Do not activate the project and use the current library paths.
3: Cancel and resolve the situation another way.

Selection: 3
- Operation canceled

Session Info

```r > session_info() ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.4.0 (2024-04-24 ucrt) os Windows 11 x64 (build 22631) system x86_64, mingw32 ui RStudio language (EN) collate English_United States.utf8 ctype English_United States.utf8 tz America/Denver date 2024-06-07 rstudio 2024.04.1+748 Chocolate Cosmos (desktop) pandoc 3.1.7 @ C:\\Users\\gueng\\AppData\\Local\\Pandoc\\pandoc.exe ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source brio 1.1.5 2024-04-24 [1] RSPM (R 4.4.0) cachem 1.1.0 2024-05-16 [1] RSPM (R 4.4.0) cli 3.6.2 2023-12-11 [1] RSPM (R 4.4.0) devtools * 2.4.5 2022-10-11 [1] RSPM (R 4.4.0) digest 0.6.35 2024-03-11 [1] RSPM (R 4.4.0) ellipsis 0.3.2 2021-04-29 [1] RSPM (R 4.4.0) fastmap 1.2.0 2024-05-15 [1] RSPM (R 4.4.0) fs 1.6.4 2024-04-25 [1] RSPM (R 4.4.0) glue 1.7.0 2024-01-09 [1] RSPM (R 4.4.0) htmltools 0.5.8.1 2024-04-04 [1] RSPM (R 4.4.0) htmlwidgets 1.6.4 2023-12-06 [1] RSPM (R 4.4.0) httpuv 1.6.15 2024-03-26 [1] RSPM (R 4.4.0) later 1.3.2 2023-12-06 [1] RSPM (R 4.4.0) lifecycle 1.0.4 2023-11-07 [1] RSPM (R 4.4.0) magrittr 2.0.3 2022-03-30 [1] RSPM (R 4.4.0) memoise 2.0.1 2021-11-26 [1] RSPM (R 4.4.0) mime 0.12 2021-09-28 [1] RSPM (R 4.4.0) miniUI 0.1.1.1 2018-05-18 [1] RSPM (R 4.4.0) pkgbuild 1.4.4 2024-03-17 [1] RSPM (R 4.4.0) pkgload 1.3.4 2024-01-16 [1] RSPM (R 4.4.0) profvis 0.3.8 2023-05-02 [1] RSPM (R 4.4.0) promises 1.3.0 2024-04-05 [1] RSPM (R 4.4.0) purrr 1.0.2 2023-08-10 [1] RSPM (R 4.4.0) R6 2.5.1 2021-08-19 [1] RSPM (R 4.4.0) Rcpp 1.0.12 2024-01-09 [1] RSPM (R 4.4.0) remotes 2.5.0 2024-03-17 [1] RSPM (R 4.4.0) renv 1.0.7 2024-04-11 [1] RSPM (R 4.4.0) rlang 1.1.4 2024-06-04 [1] RSPM (R 4.4.0) rstudioapi 0.16.0 2024-03-24 [1] RSPM (R 4.4.0) sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.4.0) shiny 1.8.1.1 2024-04-02 [1] RSPM (R 4.4.0) stringi 1.8.4 2024-05-06 [1] RSPM (R 4.4.0) stringr 1.5.1 2023-11-14 [1] RSPM (R 4.4.0) testthat * 3.2.1.1 2024-04-14 [1] RSPM (R 4.4.0) urlchecker 1.0.1 2021-11-30 [1] RSPM (R 4.4.0) usethis * 2.2.3 2024-02-19 [1] RSPM (R 4.4.0) vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.4.0) xtable 1.8-4 2019-04-21 [1] RSPM (R 4.4.0) [1] C:/Users/gueng/AppData/Local/R/win-library/4.4 [2] C:/Program Files/R/R-4.4.0/library ```

Output of renv::diagnostics()

```r > renv::diagnostics() Diagnostics Report [renv 1.0.7] =============================== # Session Info --------------------------------------------------------------- R version 4.4.0 (2024-04-24 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631) Matrix products: default locale: [1] LC_COLLATE=English_United States.utf8 [2] LC_CTYPE=English_United States.utf8 [3] LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.utf8 time zone: America/Denver tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] testthat_3.2.1.1 devtools_2.4.5 usethis_2.2.3 loaded via a namespace (and not attached): [1] miniUI_0.1.1.1 renv_1.0.7 compiler_4.4.0 brio_1.1.5 [5] promises_1.3.0 Rcpp_1.0.12 stringr_1.5.1 later_1.3.2 [9] fastmap_1.2.0 mime_0.12 R6_2.5.1 htmlwidgets_1.6.4 [13] profvis_0.3.8 shiny_1.8.1.1 rlang_1.1.4 cachem_1.1.0 [17] stringi_1.8.4 httpuv_1.6.15 fs_1.6.4 pkgload_1.3.4 [21] memoise_2.0.1 cli_3.6.2 magrittr_2.0.3 digest_0.6.35 [25] rstudioapi_0.16.0 xtable_1.8-4 remotes_2.5.0 lifecycle_1.0.4 [29] vctrs_0.6.5 glue_1.7.0 urlchecker_1.0.1 sessioninfo_1.2.2 [33] pkgbuild_1.4.4 purrr_1.0.2 tools_4.4.0 ellipsis_0.3.2 [37] htmltools_0.5.8.1 # Project -------------------------------------------------------------------- Project path: "~/renvTest" # Status --------------------------------------------------------------------- No issues found -- the project is in a consistent state. # Packages ------------------------------------------------------------------- Library Source Lockfile Source Path Dependency KernSmooth 2.23-22 CRAN [2] MASS 7.3-60.2 CRAN [2] Matrix 1.7-0 CRAN [2] PopR.common 0.0.0.9069 SPDGT [1] R6 2.5.1 RSPM [1] RColorBrewer 1.1-3 CRAN [1] Rcpp 1.0.12 RSPM [1] askpass 1.2.0 RSPM [1] base64enc 0.1-3 RSPM [1] bit 4.0.5 CRAN [1] bit64 4.0.5 CRAN [1] boot 1.3-30 CRAN [2] brew 1.0-10 RSPM [1] brio 1.1.5 RSPM [1] bslib 0.7.0 RSPM [1] cachem 1.1.0 RSPM [1] callr 3.7.6 RSPM [1] class 7.3-22 CRAN [2] cli 3.6.2 RSPM [1] clipr 0.8.0 RSPM [1] cluster 2.1.6 CRAN [2] codetools 0.2-20 CRAN [2] colorspace 2.1-0 CRAN [1] commonmark 1.9.1 RSPM [1] cpp11 0.4.7 RSPM [1] crayon 1.5.2 RSPM [1] credentials 2.0.1 RSPM [1] crosstalk 1.2.1 CRAN [1] curl 5.2.1 RSPM [1] data.table 1.15.4 CRAN [1] desc 1.4.3 RSPM [1] devtools 2.4.5 RSPM [1] diffobj 0.3.5 RSPM [1] digest 0.6.35 RSPM [1] downlit 0.4.3 RSPM [1] dplyr 1.1.4 CRAN [1] ellipsis 0.3.2 RSPM [1] evaluate 0.23 RSPM [1] fansi 1.0.6 RSPM [1] farver 2.1.2 CRAN [1] fastmap 1.2.0 RSPM [1] fontawesome 0.5.2 RSPM [1] foreign 0.8-86 CRAN [2] fs 1.6.4 RSPM [1] generics 0.1.3 CRAN [1] gert 2.0.1 RSPM [1] ggplot2 3.5.1 CRAN [1] gh 1.4.1 RSPM [1] gitcreds 0.1.2 RSPM [1] glue 1.7.0 RSPM [1] gtable 0.3.5 CRAN [1] highr 0.11 RSPM [1] hms 1.1.3 CRAN [1] htmltools 0.5.8.1 RSPM [1] htmlwidgets 1.6.4 RSPM [1] httpuv 1.6.15 RSPM [1] httr 1.4.7 RSPM [1] httr2 1.0.1 CRAN [1] ini 0.3.1 RSPM [1] isoband 0.2.7 CRAN [1] jquerylib 0.1.4 RSPM [1] jsonlite 1.8.8 RSPM [1] knitr 1.47 RSPM [1] labeling 0.4.3 CRAN [1] later 1.3.2 RSPM [1] lattice 0.22-6 CRAN [2] lazyeval 0.2.2 CRAN [1] lifecycle 1.0.4 RSPM [1] lubridate 1.9.3 CRAN [1] magrittr 2.0.3 RSPM [1] memoise 2.0.1 RSPM [1] mgcv 1.9-1 CRAN [2] mime 0.12 RSPM [1] miniUI 0.1.1.1 RSPM [1] munsell 0.5.1 CRAN [1] nlme 3.1-164 CRAN [2] nnet 7.3-19 CRAN [2] openssl 2.2.0 RSPM [1] pillar 1.9.0 RSPM [1] pkgbuild 1.4.4 RSPM [1] pkgconfig 2.0.3 RSPM [1] pkgdown 2.0.9 RSPM [1] pkgload 1.3.4 RSPM [1] plotly 4.10.4 CRAN [1] praise 1.0.0 RSPM [1] prettyunits 1.2.0 RSPM [1] processx 3.8.4 RSPM [1] profvis 0.3.8 RSPM [1] progress 1.2.3 CRAN [1] promises 1.3.0 RSPM [1] ps 1.7.6 RSPM [1] purrr 1.0.2 RSPM [1] ragg 1.3.2 RSPM [1] rappdirs 0.3.3 RSPM [1] rcmdcheck 1.4.0 RSPM [1] readr 2.1.5 CRAN [1] rematch2 2.1.2 RSPM [1] remotes 2.5.0 RSPM [1] renv 1.0.7 RSPM 1.0.7 RSPM [1] direct rlang 1.1.4 RSPM [1] rmarkdown 2.27 RSPM [1] roxygen2 7.3.1 RSPM [1] rpart 4.1.23 CRAN [2] rprojroot 2.0.4 RSPM [1] rstudioapi 0.16.0 RSPM [1] rversions 2.1.2 RSPM [1] sass 0.4.9 RSPM [1] scales 1.3.0 CRAN [1] sessioninfo 1.2.2 RSPM [1] shiny 1.8.1.1 RSPM [1] sourcetools 0.1.7-1 RSPM [1] spatial 7.3-17 CRAN [2] spdgt.sim 0.0.0.9002 SPDGT [1] stringi 1.8.4 RSPM [1] stringr 1.5.1 RSPM [1] survival 3.5-8 CRAN [2] sys 3.4.2 RSPM [1] systemfonts 1.1.0 RSPM [1] testthat 3.2.1.1 RSPM [1] textshaping 0.4.0 RSPM [1] tibble 3.2.1 RSPM [1] tidyr 1.3.1 CRAN [1] tidyselect 1.2.1 CRAN [1] timechange 0.3.0 CRAN [1] tinytex 0.51 RSPM [1] tzdb 0.4.0 CRAN [1] urlchecker 1.0.1 RSPM [1] usethis 2.2.3 RSPM [1] utf8 1.2.4 RSPM [1] utils [2] indirect vctrs 0.6.5 RSPM [1] viridisLite 0.4.2 CRAN [1] vroom 1.6.5 CRAN [1] waldo 0.5.2 RSPM [1] whisker 0.4.1 RSPM [1] withr 3.0.0 RSPM [1] xfun 0.44 RSPM [1] xml2 1.3.6 RSPM [1] xopen 1.0.1 RSPM [1] xtable 1.8-4 RSPM [1] yaml 2.3.8 RSPM [1] zip 2.3.1 RSPM [1] [1]: C:/Users/gueng/AppData/Local/R/win-library/4.4 [2]: C:/Program Files/R/R-4.4.0/library # ABI ------------------------------------------------------------------------ - ABI conflict checks are not available on Windows. # User Profile --------------------------------------------------------------- Source Package Require Version Dev 1 C:/Users/gueng/Documents/.Rprofile devtools TRUE 2 C:/Users/gueng/Documents/.Rprofile testthat TRUE 3 C:/Users/gueng/Documents/.Rprofile usethis TRUE # Settings ------------------------------------------------------------------- List of 13 $ bioconductor.version : NULL $ external.libraries : chr(0) $ ignored.packages : chr(0) $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo" $ ppm.enabled : NULL $ ppm.ignored.urls : chr(0) $ r.version : NULL $ snapshot.type : chr "implicit" $ use.cache : logi TRUE $ vcs.ignore.cellar : logi TRUE $ vcs.ignore.library : logi TRUE $ vcs.ignore.local : logi TRUE $ vcs.manage.ignores : logi TRUE # Options -------------------------------------------------------------------- List of 7 $ defaultPackages : chr [1:6] "datasets" "utils" "grDevices" "graphics" ... $ download.file.method : chr "libcurl" $ download.file.extra : NULL $ install.packages.compile.from.source: chr "interactive" $ pkgType : chr "both" $ repos : Named chr [1:2] "https://packagemanager.posit.co/cran/latest" "https://my_repo_url" ..- attr(*, "names")= chr [1:2] "CRAN" "SPDGT" $ renv.verbose : logi TRUE # Environment Variables ------------------------------------------------------ HOME = C:\Users\gueng\Documents LANG = MAKE = R_LIBS = R_LIBS_SITE = C:/PROGRA~1/R/R-44~1.0/site-library R_LIBS_USER = C:\Users\gueng\AppData\Local/R/win-library/4.4 # PATH ----------------------------------------------------------------------- - C:\rtools44\x86_64-w64-mingw32.static.posix\bin - C:\rtools44\usr\bin - C:\Program Files\R\R-4.4.0\bin\x64 - C:\Program Files (x86)\Common Files\Oracle\Java\javapath - C:\Python39\Scripts\ - C:\Python39\ - C:\Program Files\Microsoft MPI\Bin\ - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\libnvvp - C:\Program Files\Python36\Scripts\ - C:\Program Files\Python36\ - C:\Rtools\bin - C:\Windows\system32 - C:\Windows - C:\Windows\System32\Wbem - C:\Windows\System32\WindowsPowerShell\v1.0\ - C:\Windows\System32\OpenSSH\ - C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL - C:\Program Files\Intel\Intel(R) Management Engine Components\DAL - C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common - C:\Program Files\Intel\WiFi\bin\ - C:\Program Files\Common Files\Intel\WirelessCommon\ - C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\ - C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ - C:\Program Files\Microsoft SQL Server\130\Tools\Binn\ - C:\Program Files\dotnet\ - C:\Users\EN999\AppData\Local\Programs\Python\Python38 - C:\Users\EN999\AppData\Local\Programs\Python\Python38\Scripts - C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\ - C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.1.0\ - C:\WINDOWS\system32 - C:\WINDOWS - C:\WINDOWS\System32\Wbem - C:\WINDOWS\System32\WindowsPowerShell\v1.0\ - C:\WINDOWS\System32\OpenSSH\ - C:\Program Files\Azure Data Studio\bin - C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\ - C:\Program Files\Microsoft SQL Server\150\Tools\Binn\ - C:\Program Files\PuTTY\ - C:\Program Files\gs\gs9.53.3\bin - C:\Program Files\Microsoft SQL Server Migration Assistant for Access\bin\ - C:\Program Files\nodejs\ - C:\ProgramData\chocolatey\bin - C:\Program Files\Sublime Text 3 - C:\Program Files\sumatra - C:\Users\gueng\AppData\Local\Programs\MiKTeX\miktex\bin\x64 - C:\Program Files\Git\cmd - C:\Users\gueng\AppData\Roaming\Python\Python39\Scripts - C:\Program Files\R\R-4.3.1\bin\x64 - C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\ - C:\Program Files\Microsoft SQL Server\150\DTS\Binn\ - C:\Program Files\apache-maven-3.9.6\bin - C:\Users\gueng\Downloads - C:\Program Files\Docker\Docker\resources\bin - C:\Users\gueng\AppData\Roaming\TinyTeX\bin\windows - C:\Users\gueng\AppData\Local\Microsoft\WindowsApps - C:\Users\gueng\AppData\Local\Programs\MiKTeX\miktex\bin\x64\ - C:\Program Files\sumatra\SumatraPDF - C:\Program Files\Sublime Text 3\sublime_text - C:\Users\gueng\AppData\Local\gitkraken\bin - C:\Users\gueng\AppData\Local\Microsoft\WindowsApps - C:\Users\gueng\AppData\Local\Programs\Microsoft VS Code\bin - C:\Users\gueng\AppData\Local\Pandoc\ - C:\Users\gueng\Documents - C:\Program Files\RStudio\resources\app\bin\quarto\bin - C:\Program Files\RStudio\resources\app\bin\postback # Cache ---------------------------------------------------------------------- There are a total of 30 packages installed in the renv cache. Cache path: "C:/Users/gueng/AppData/Local/R/cache/R/renv/cache/v5/windows/R-4.4/x86_64-w64-mingw32" ```
kevinushey commented 5 months ago

Can you confirm that the output of getwd() matches what you expect in each case? That is, is the working directory still renvTest after renv::init() is called and the session is restarted?

Are you using RStudio? If so, did you create a project, and open that project? Or are you just setting the working directory by hand?

gjg525 commented 5 months ago

I am working in an RStudio project and not setting the working directory by hand. getwd() is matching what is expected (the R project directory) both before and after calling renv::init().

wiedenhoeft commented 5 months ago

I have the exact same problem, getwd() is correct as well.

ahasverus commented 5 days ago

Hi,

I have a similar issue. I prefer to report my problem here even if I am on GNU/Linux (tell me if I need to create a different issue).

I use R inside RStudio Desktop (all my system [OS, software and packages] is up-to-date). Note that I always use RStudio projects (.Rproj file) and never use setwd().

When I initialize renv with renv::init() in an existing directory (open in RStudio by clicking the .Rproj file), I have the following message:

## 0utput of renv::init() ----

- Linking packages into the project library ... Done!
The following package(s) will be updated in the lockfile:

# CRAN -----------------------------------------------------------------------
- callr       [* -> 3.7.6]
- cli         [* -> 3.6.3]
- desc        [* -> 1.4.3]
- fs          [* -> 1.6.5]
- glue        [* -> 1.8.0]
- lifecycle   [* -> 1.0.4]
- pkgbuild    [* -> 1.4.5]
- pkgload     [* -> 1.4.0]
- processx    [* -> 3.8.4]
- ps          [* -> 1.8.1]
- R6          [* -> 2.5.1]
- renv        [* -> 1.0.11]
- rlang       [* -> 1.1.4]
- rprojroot   [* -> 2.0.4]
- withr       [* -> 3.0.2]

The version of R recorded in the lockfile will be updated:
- R           [* -> 4.4.2]

- Lockfile written to "~/github/test/renv.lock".

Restarting R session...

At this stage, everything seems to be ok: the lockfile contains metadata of all required packages (pkgload and all the dependencies) and packages are "installed" in renv/library/.

This is confirmed by the message printed by renv::status():

## 0utput of renv::status() ----

No issues found -- the project is in a consistent state.

But when I run renv::snapshot(), renv seems to be not activated:

## 0utput of renv::snapshot() ----

It looks like you've called renv::snapshot() in a project that hasn't been activated yet.
How would you like to proceed? 

1: Activate the project and use the project library.
2: Do not activate the project and use the current library paths.
3: Cancel and resolve the situation another way.

If I select 1, the R session restarts, but renv is still not activated. I can do this again and again, renv remains deactivated.

If I add a new package in my code and run renv::status() the new package is detected:

## 0utput of renv::status() ----

The following package(s) are in an inconsistent state:

 package installed recorded used
 remotes y         n        y   

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

But I cannot register this package in the lockfile.

Note, I use my own User .Rprofile located in ~/.config/R/.Rprofile, but no Project .Rprofile (except the one created by renv).

Here is some additional information:

Session info

```r ## Output of sessioninfo::session_info() ---- ─ Session info ──────────────────────────────────────────────── setting value version R version 4.4.2 (2024-10-31) os Arch Linux system x86_64, linux-gnu ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz Europe/Paris date 2024-11-12 rstudio 2024.09.0+375 Cranberry Hibiscus (desktop) pandoc 3.1.11.1 @ /usr/bin/pandoc ─ Packages ──────────────────────────────────────────────────── package * version date (UTC) lib source cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.1) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.1) [1] /home/nicolas/.local/bin/R/x86_64-pc-linux-gnu-library/4.4 [2] /usr/lib/R/library ```

renv diagnostics

```r ## Output of renv::diagnostics() ---- Diagnostics Report [renv 1.0.11] ================================ # /etc/arch-release ---------------------------------------------------------- # /etc/os-release ------------------------------------------------------------ NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo # Session Info --------------------------------------------------------------- R version 4.4.2 (2024-10-31) Platform: x86_64-pc-linux-gnu Running under: Arch Linux Matrix products: default BLAS: /usr/lib/libblas.so.3.12.0 LAPACK: /usr/lib/liblapack.so.3.12.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: Europe/Paris tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] BiocManager_1.30.25 compiler_4.4.2 tools_4.4.2 [4] remotes_2.5.0 renv_1.0.11 # Project -------------------------------------------------------------------- Project path: "~/github/test" # Status --------------------------------------------------------------------- No issues found -- the project is in a consistent state. # Packages ------------------------------------------------------------------- Library Source Lockfile Source Path Dependency AsioHeaders 1.22.1-2 CRAN [1] AzureAuth 1.3.3 CRAN [1] AzureGraph 1.3.4 CRAN [1] BH 1.84.0-0 CRAN [1] BiocManager 1.30.25 CRAN [1] CoordinateCleaner 3.0.1 CRAN [1] DBI 1.2.3 CRAN [1] DT 0.33 CRAN [1] Formula 1.2-5 CRAN [1] Hmisc 5.2-0 CRAN [1] KernSmooth 2.23-24 CRAN [2] MASS 7.3-61 CRAN [1] Matrix 1.7-1 CRAN [1] Microsoft365R 2.4.0 CRAN [1] NLP 0.3-0 CRAN [1] R.cache 0.16.0 CRAN [1] R.methodsS3 1.8.2 CRAN [1] R.oo 1.27.0 CRAN [1] R.utils 2.12.3 CRAN [1] R6 2.5.1 CRAN 2.5.1 CRAN [1] indirect RApiSerialize 0.1.4 CRAN [1] RColorBrewer 1.1-3 CRAN [1] RSQLite 2.3.7 CRAN [1] Rcpp 1.0.13-1 CRAN [1] RcppArmadillo 14.0.2-1 CRAN [1] RcppParallel 5.1.9 CRAN [1] SnowballC 0.7.1 CRAN [1] V8 6.0.0 CRAN [1] WikidataQueryServiceR 1.0.0 CRAN [1] WikidataR 2.3.3 CRAN [1] WikipediR 1.7.1 CRAN [1] XML 3.99-0.17 CRAN [1] ade4 1.7-22 CRAN [1] ami 0.2.0 CRAN [1] ape 5.8 CRAN [1] askpass 1.2.1 CRAN [1] assertthat 0.2.1 CRAN [1] audio 0.1-11 CRAN [1] backports 1.5.0 CRAN [1] base64enc 0.1-3 CRAN [1] bdc 1.1.4 CRAN [1] beepr 2.0 CRAN [1] bib2df 1.1.2.0 CRAN [1] bibliometrix 4.3.0 CRAN [1] bibliometrixData 0.3.0 CRAN [1] bit 4.5.0 CRAN [1] bit64 4.5.2 CRAN [1] blastula 0.3.5 CRAN [1] blob 1.2.4 CRAN [1] blogdown 1.19 CRAN [1] bmp 0.3 CRAN [1] bookdown 0.41 CRAN [1] boot 1.3-31 CRAN [1] brew 1.0-10 CRAN [1] brio 1.1.5 CRAN [1] bslib 0.8.0 CRAN [1] ca 0.71.1 CRAN [1] cachem 1.1.0 CRAN [1] callr 3.7.6 CRAN 3.7.6 CRAN [1] indirect cellranger 1.1.0 CRAN [1] cffr 1.1.1 CRAN [1] checkmate 2.3.2 CRAN [1] class 7.3-22 CRAN [2] classInt 0.4-10 CRAN [1] cli 3.6.3 CRAN 3.6.3 CRAN [1] indirect clipr 0.8.0 CRAN [1] clisymbols 1.2.0 CRAN [1] cluster 2.1.6 CRAN [2] codemeta 0.1.1 CRAN [1] codemetar 0.3.5 CRAN [1] codetools 0.2-20 CRAN [2] collections 0.3.7 CRAN [1] colorspace 2.1-1 CRAN [1] commonmark 1.9.2 CRAN [1] contentid 0.0.18 CRAN [1] covr 3.6.4 CRAN [1] cpp11 0.5.0 CRAN [1] crayon 1.5.3 CRAN [1] credentials 2.0.2 CRAN [1] crosstalk 1.2.1 CRAN [1] crul 1.5.0 CRAN [1] curl 6.0.0 CRAN [1] cyclocomp 1.1.1 CRAN [1] data.table 1.16.2 CRAN [1] dbplyr 2.5.0 CRAN [1] desc 1.4.3 CRAN 1.4.3 CRAN [1] indirect devtools 2.4.5 CRAN [1] diffobj 0.3.5 CRAN [1] digest 0.6.37 CRAN [1] dimensionsR 0.0.3 CRAN [1] distill 1.6 CRAN [1] downlit 0.4.4 CRAN [1] downloader 0.4 CRAN [1] dplyr 1.1.4 CRAN [1] duckdb 1.1.2 CRAN [1] e1071 1.7-16 CRAN [1] ellipsis 0.3.2 CRAN [1] evaluate 1.0.1 CRAN [1] fansi 1.0.6 CRAN [1] farver 2.1.2 CRAN [1] fastmap 1.2.0 CRAN [1] fastmatch 1.1-4 CRAN [1] fmsb 0.7.6 CRAN [1] fontawesome 0.5.2 CRAN [1] forcats 1.0.0 CRAN [1] forcis 0.0.0.9000 unknown [1] foreach 1.5.2 CRAN [1] foreign 0.8-87 CRAN [1] fs 1.6.5 CRAN 1.6.5 CRAN [1] indirect generics 0.1.3 CRAN [1] geojsonsf 2.0.3 CRAN [1] geometries 0.2.4 CRAN [1] geosphere 1.5-20 CRAN [1] gert 2.1.4 CRAN [1] getPass 0.2-4 CRAN [1] ggfun 0.1.7 CRAN [1] ggimage 0.3.3 CRAN [1] ggplot2 3.5.1 CRAN [1] ggplotify 0.1.2 CRAN [1] ggrepel 0.9.6 CRAN [1] gh 1.4.1 CRAN [1] ghql 0.1.0 CRAN [1] gitcreds 0.1.2 CRAN [1] glue 1.8.0 CRAN 1.8.0 CRAN [1] indirect goodpractice 1.0.5.9000 GitHub [1] grDevices [2] indirect graphics [2] indirect graphql 1.5.2 CRAN [1] gridExtra 2.3 CRAN [1] gridGraphics 0.5-1 CRAN [1] gsheet 0.4.5 CRAN [1] gtable 0.3.6 CRAN [1] gtools 3.9.5 CRAN [1] here 1.0.1 CRAN [1] hexSticker 0.4.9 CRAN [1] hexbin 1.28.4 CRAN [1] highr 0.11 CRAN [1] hms 1.1.3 CRAN [1] htmlTable 2.4.3 CRAN [1] htmltools 0.5.8.1 CRAN [1] htmlwidgets 1.6.4 CRAN [1] httpcode 0.3.0 CRAN [1] httpgd 2.0.2 CRAN [1] httpuv 1.6.15 CRAN [1] httr 1.4.7 CRAN [1] httr2 1.0.6 CRAN [1] humaniformat 0.6.0 CRAN [1] igraph 2.1.1 CRAN [1] imager 1.0.2 CRAN [1] ini 0.3.1 CRAN [1] isoband 0.2.7 CRAN [1] iterators 1.0.14 CRAN [1] janeaustenr 1.0.0 CRAN [1] janitor 2.2.0 CRAN [1] jose 1.2.1 CRAN [1] jpeg 0.1-10 CRAN [1] jquerylib 0.1.4 CRAN [1] jsonify 1.2.2 CRAN [1] jsonlite 1.8.9 CRAN [1] jsonvalidate 1.3.2 CRAN [1] knitr 1.49 CRAN [1] labeling 0.4.3 CRAN [1] languageserver 0.3.16 CRAN [1] later 1.3.2 CRAN [1] lattice 0.22-6 CRAN [2] lazyeval 0.2.2 CRAN [1] leafem 0.2.3 CRAN [1] leaflet 2.2.2 CRAN [1] leaflet.providers 2.0.0 CRAN [1] leafpop 0.1.0 CRAN [1] lifecycle 1.0.4 CRAN 1.0.4 CRAN [1] indirect lintr 3.1.2 CRAN [1] lubridate 1.9.3 CRAN [1] lwgeom 0.2-14 CRAN [1] magick 2.8.5 CRAN [1] magrittr 2.0.3 CRAN [1] maplegend 0.1.0 CRAN [1] mapproj 1.2.11 CRAN [1] maps 3.4.2.1 CRAN [1] mapsf 0.12.0 CRAN [1] mapview 2.11.2 CRAN [1] mathjaxr 1.6-0 CRAN [1] memoise 2.0.1 CRAN [1] messages 1.0 GitHub [1] metadat 1.2-0 CRAN [1] methods [2] indirect mgcv 1.9-1 CRAN [2] mime 0.12 CRAN [1] miniUI 0.1.1.1 CRAN [1] modeltools 0.2-23 CRAN [1] munsell 0.5.1 CRAN [1] natserv 1.0.0 CRAN [1] ngram 3.2.3 CRAN [1] nlme 3.1-166 CRAN [1] nnet 7.3-19 CRAN [2] oai 0.4.0 CRAN [1] openalexR 1.4.0 CRAN [1] openssl 2.2.2 CRAN [1] openxlsx 4.2.7.1 CRAN [1] pak 0.8.0 CRAN [1] pbapply 1.7-2 CRAN [1] phangorn 2.12.1 CRAN [1] pillar 1.9.0 CRAN [1] pingr 2.0.4 CRAN [1] pixmap 0.4-13 CRAN [1] pkgbuild 1.4.5 CRAN 1.4.5 CRAN [1] indirect pkgcheck 0.1.2.058 GitHub [1] pkgconfig 2.0.3 CRAN [1] pkgdown 2.1.1 CRAN [1] pkgload 1.4.0 CRAN 1.4.0 CRAN [1] direct pkgstats 0.1.6.017 GitHub [1] planner 0.1 GitHub [1] plogr 0.2.0 CRAN [1] plotly 4.10.4 CRAN [1] plyr 1.8.9 CRAN [1] png 0.1-8 CRAN [1] praise 1.0.0 CRAN [1] prettyunits 1.2.0 CRAN [1] processx 3.8.4 CRAN 3.8.4 CRAN [1] indirect profvis 0.4.0 CRAN [1] progress 1.2.3 CRAN [1] promises 1.3.0 CRAN [1] proxy 0.4-27 CRAN [1] ps 1.8.1 CRAN 1.8.1 CRAN [1] indirect pubmedR 0.0.3 CRAN [1] purrr 1.0.2 CRAN [1] qs 0.27.2 CRAN [1] quadprog 1.5-8 CRAN [1] ragg 1.3.3 CRAN [1] rapidjsonr 1.2.0 CRAN [1] rappdirs 0.3.3 CRAN [1] raster 3.6-30 CRAN [1] ratelimitr 0.4.1 CRAN [1] rbibtools 0.0.1 GitHub [1] rcmdcheck 1.4.0 CRAN [1] rcompendium 1.3.9000 unknown [1] rdeps 0.2 GitHub [1] readbitmap 0.1.5 CRAN [1] readr 2.1.5 CRAN [1] readxl 1.4.3 CRAN [1] rematch 2.0.0 CRAN [1] rematch2 2.1.2 CRAN [1] remotes 2.5.0 CRAN [1] rentrez 1.2.3 CRAN [1] renv 1.0.11 CRAN 1.0.11 CRAN [1] direct repr 1.1.7 CRAN [1] revtools 0.4.1 CRAN [1] rex 1.2.1 CRAN [1] rgbif 3.8.1 CRAN [1] rgnparser 0.3.0 CRAN [1] ritis 1.0.0 CRAN [1] rlang 1.1.4 CRAN 1.1.4 CRAN [1] indirect rmarkdown 2.29 CRAN [1] rnaturalearth 1.0.1 CRAN [1] rnaturalearthdata 1.0.0 CRAN [1] rncl 0.8.7 CRAN [1] rotl 3.1.0 CRAN [1] roxygen2 7.3.2 CRAN [1] rpart 4.1.23 CRAN [2] rprojroot 2.0.4 CRAN 2.0.4 CRAN [1] indirect rredlist 0.7.1 CRAN [1] rscopus 0.6.6 CRAN [1] rstudioapi 0.17.1 CRAN [1] rtry 1.1.0 CRAN [1] rutils 0.0.0.9000 GitHub [1] rversions 2.1.2 CRAN [1] rvest 1.0.4 CRAN [1] rwoslite 0.0.1 GitHub [1] rwosstarter 0.1 GitHub [1] s2 1.1.7 CRAN [1] sass 0.4.9 CRAN [1] satellite 1.0.5 CRAN [1] scales 1.3.0 CRAN [1] selectr 0.4-2 CRAN [1] servr 0.32 CRAN [1] sessioninfo 1.2.2 CRAN [1] sf 1.0-19 CRAN [1] sfheaders 0.4.4 CRAN [1] shiny 1.9.1 CRAN [1] shinydashboard 0.7.2 CRAN [1] showtext 0.9-7 CRAN [1] showtextdb 3.0 CRAN [1] skimr 2.1.5 CRAN [1] slam 0.1-54 CRAN [1] snakecase 0.11.1 CRAN [1] solrium 1.2.0 CRAN [1] sourcetools 0.1.7-1 CRAN [1] sp 2.1-4 CRAN [1] spatial 7.3-17 CRAN [2] srr 0.1.3.012 GitHub [1] stats [2] indirect stringdist 0.9.12 CRAN [1] stringfish 0.16.0 CRAN [1] stringi 1.8.4 CRAN [1] stringr 1.5.1 CRAN [1] styler 1.10.3 CRAN [1] survival 3.7-0 CRAN [1] svglite 2.1.3 CRAN [1] sys 3.4.3 CRAN [1] sysfonts 0.8.9 CRAN [1] systemfonts 1.1.0 CRAN [1] taxadb 0.2.1 CRAN [1] terra 1.7-83 CRAN [1] testthat 3.2.1.1 CRAN [1] textshaping 0.4.0 CRAN [1] tibble 3.2.1 CRAN [1] tidyr 1.3.1 CRAN [1] tidyselect 1.2.1 CRAN [1] tidytext 0.4.2 CRAN [1] tiff 0.1-12 CRAN [1] timechange 0.3.0 CRAN [1] tinytex 0.54 CRAN [1] tm 0.7-14 CRAN [1] tokenizers 0.3.0 CRAN [1] topicmodels 0.2-17 CRAN [1] traitdata 0.0.1 GitHub [1] triebeard 0.4.1 CRAN [1] tzdb 0.4.0 CRAN [1] unigd 0.1.2 CRAN [1] units 0.8-5 CRAN [1] urlchecker 1.0.1 CRAN [1] urltools 1.7.3 CRAN [1] usethis 3.0.0 CRAN [1] utf8 1.2.4 CRAN [1] utils [2] indirect uuid 1.2-1 CRAN [1] vctrs 0.6.5 CRAN [1] vdiffr 1.0.8 CRAN [1] viridis 0.6.5 CRAN [1] viridisLite 0.4.2 CRAN [1] visNetwork 2.1.2 CRAN [1] vroom 1.6.5 CRAN [1] waldo 0.6.1 CRAN [1] whisker 0.4.1 CRAN [1] whoami 1.3.0 CRAN [1] wikitaxa 0.4.0 CRAN [1] withr 3.0.2 CRAN 3.0.2 CRAN [1] indirect wk 0.9.4 CRAN [1] worrms 0.4.3 CRAN [1] writexl 1.5.1 CRAN [1] xfun 0.49 CRAN [1] xml2 1.3.6 CRAN [1] xmlparsedata 1.0.5 CRAN [1] xopen 1.0.1 CRAN [1] xtable 1.8-4 CRAN [1] yaml 2.3.10 CRAN [1] yulab.utils 0.1.8 CRAN [1] zip 2.3.1 CRAN [1] zoo 1.8-12 CRAN [1] zoteror 0.0.1 unknown [1] [1]: /home/nicolas/.local/bin/R/x86_64-pc-linux-gnu-library/4.4 [2]: /usr/lib/R/library # ABI ------------------------------------------------------------------------ - No ABI problems were detected in the set of installed packages. # User Profile --------------------------------------------------------------- [no user profile detected] # Settings ------------------------------------------------------------------- List of 13 $ bioconductor.version : NULL $ external.libraries : chr(0) $ ignored.packages : chr(0) $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo" $ ppm.enabled : NULL $ ppm.ignored.urls : chr(0) $ r.version : NULL $ snapshot.type : chr "implicit" $ use.cache : logi TRUE $ vcs.ignore.cellar : logi TRUE $ vcs.ignore.library : logi TRUE $ vcs.ignore.local : logi TRUE $ vcs.manage.ignores : logi TRUE # Options -------------------------------------------------------------------- List of 7 $ defaultPackages : chr [1:6] "datasets" "utils" "grDevices" "graphics" ... $ download.file.method : chr "libcurl" $ download.file.extra : NULL $ install.packages.compile.from.source: NULL $ pkgType : chr "source" $ repos : Named chr "https://cloud.r-project.org/" ..- attr(*, "names")= chr "CRAN" $ renv.verbose : logi TRUE # Environment Variables ------------------------------------------------------ HOME = /home/nicolas LANG = en_US.UTF-8 MAKE = make R_LIBS = R_LIBS_SITE = /usr/lib64/R/site-library R_LIBS_USER = ~/.local/bin/R/x86_64-pc-linux-gnu-library/4.4 # PATH ----------------------------------------------------------------------- - /usr/local/bin - /usr/bin - /usr/local/sbin - /usr/bin/site_perl - /usr/bin/vendor_perl - /usr/bin/core_perl - /opt/quarto/bin - /usr/lib/rstudio/resources/app/bin/postback # Cache ---------------------------------------------------------------------- There are a total of 96 packages installed in the renv cache. Cache path: "~/.cache/R/renv/cache/v5/linux-arch-rolling/R-4.4/x86_64-pc-linux-gnu" ```

NB I tried renv on Windows 11 (latest versions of R and renv) and everything works fine.

Thanks.

kevinushey commented 5 days ago

Can you try the following and let me know what you see?

trace(renv:::renv_project_loaded, quote({
  print(project)
  print(renv:::the$project_path)
}))

renv::snapshot()

Does setting options(renv.config.activate.prompt = FALSE) help as a workaround?

ahasverus commented 4 days ago

Thanks for your quick feedback!

When I run the first code, I have:

trace(renv:::renv_project_loaded, quote({
  print(project)
  print(renv:::the$project_path)
}))

## Tracing function "renv_project_loaded" in package "renv (not-exported)"
## [1] "renv_project_loaded"
renv::snapshot()

## Tracing renv_project_loaded(project) on entry 
## [1] "/home/nicolas/github/test"
## NULL
## It looks like you've called renv::snapshot() in a project that hasn't been activated yet.
## How would you like to proceed? 

## 1: Activate the project and use the project library.
## 2: Do not activate the project and use the current library paths.
## 3: Cancel and resolve the situation another way.

When I modify the global option renv.config.activate.prompt, I can update the lockfile with renv::snapshot():

options(renv.config.activate.prompt = FALSE)

renv::snapshot()

## The following package(s) will be updated in the lockfile:
## 
## # CRAN -----------------------------------------------------------------------
## - remotes   [* -> 2.5.0]

## Do you want to proceed? [Y/n]: y
## - Lockfile written to "~/github/test/renv.lock".

renv::status()

## No issues found -- the project is in a consistent state.

This hack also works after removing a package (here remotes):

renv::snapshot()

## The following package(s) will be updated in the lockfile:

## # CRAN -----------------------------------------------------------------------
## - remotes   [2.5.0 -> *]

## Do you want to proceed? [Y/n]: y

## - Lockfile written to "~/github/test/renv.lock".

renv::status()

## No issues found -- the project is in a consistent state.
kevinushey commented 4 days ago

Strange; I would have expected at least some project name to be indicated.

Are you seeing a message like:

- Project '~/project/path' loaded. [renv 1.0.11]

when R is started for this project? Are you launching R in the working directory of the project you're working in? Does the project folder contain a .Rprofile, and is that invoking source("renv/activate.R")?

ahasverus commented 4 days ago

Here is my answer.

And my project structure:

.
├── .Rprofile
├── renv/
│   ├── activate.R
│   ├── library/
│   └── settings.json
├── renv.lock
├── test.R
└── test.Rproj
ahasverus commented 4 days ago

I don't know if this can help, but I have changed the location of my R dotfiles by adding this line in the file /etc/R/Renviron:

R_ENVIRON_USER=${HOME}/.config/R/.Renviron

And I have these lines in the ~/.config/R/.Renviron:

R_PROFILE_USER=~/.config/R/.Rprofile
R_LIBS_USER=~/.local/bin/R/%p-library/%v

I don't have any issue when installing packages and my user-level .Renviron and .Rprofile are correctly loaded by R at startup. But maybe this can explain why renv has trouble to activate.

kevinushey commented 4 days ago

I launch RStudio by double-clicking the .Rproj file.

Thanks, this is the bit of information I was missing. I can reproduce in this scenario, but I suspect the issue here is an RStudio one. I'll see if I can get this fixed up on the RStudio side.

kevinushey commented 4 days ago

Sorry, I misspoke; I'm still not able to reproduce. But I suspect that the problem lies in your .Renviron definition. By setting:

R_PROFILE_USER=~/.config/R/.Rprofile

you are overriding R's default behavior, in which it will first attempt to look for a .Rprofile in the current working directory, then the user home directory. For reference:

https://github.com/wch/r-source/blob/dcce8baeaa14a527be1b7b688e0f44eb9f7022f7/src/unix/sys-unix.c#L67-L88

In short; you'll need to stop setting R_PROFILE_USER in this way if you want to use renv, or you'll need to manually load a project .Rprofile from your user .Rprofile if you want to continue doing this.

ahasverus commented 3 days ago

Thanks for your feedback.

Indeed, I commented the line R_PROFILE_USER=~/.config/R/.Rprofile in my User .Renviron (~/.config/R/.Renviron) and it works: I can see the renv message on R startup.

So, I followed your second recommendation and patched my problem by adding this code chunk in my User .Rprofile (~/.config/R/.Rprofile):

.First <- function() {
  if (file.exists("./.Rprofile")) {
    source("./.Rprofile")
  }
}

And renv is now working as usual.

## - Project '~/github/test' loaded. [renv 1.0.11]

Thanks and sorry for the inconvenience. Nicolas

kevinushey commented 3 days ago

No worries! I appreciate the report, and it'll help others who have configured R in a similar way.