posit-dev / positron

Positron, a next-generation data science IDE
Other
2.55k stars 79 forks source link

Cannot load R packages #5015

Open tm-89 opened 2 days ago

tm-89 commented 2 days ago

System details:

macOS Sequoia (Version 15.0.1)

Positron and OS details:

Positron Version: 2024.10.0 (Universal) build 14 Code - OSS Version: 1.93.0 Commit: 901ab5d11d694212d32e53b97f771c5d601e428e Date: 2024-10-09T15:26:55.363Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Darwin arm64 24.0.0

Interpreter details:

R 4.4.1

Describe the issue:

So far I mainly used R via RStudio. Trying to use it via Positron leads to issues when trying to load packages. See the corresponding output below.

Steps to reproduce the issue:

  1. Install package (via install.packages command).
  2. Load package (gives the above error message).

Expected or desired behavior:

Package to be loaded successfully. If possible I'd like to directly use the packages I installed via RStudio (which uses the same R version).

Were there any error messages in the UI, Output panel, or Developer Tools console?

Image

jmcphers commented 1 day ago

Judging from the screenshot, it looks like the problem is that there's some crosstalk between R 4.4 and R 4.3 on your machine. The vctrs.so file in the R 4.4 package library is linking to R 4.3's libr.dylib file, which is wrong.

Could you provide a little more info?

tm-89 commented 1 day ago

Thanks for the reply! One thing I forgot to mention is that I can load certain packages (e.g. terra).

juliasilge commented 1 day ago

Can you say more about how/why you say you have installed R 4.2, 4.3, and 4.4 all on your machine? Do you mean all at the same time, or first you installed R 4.2, then later replaced it with R 4.3, etc? It is not typically possible or recommended to install and use multiple regular R installations from CRAN, especially on macOS.

(If you are interested in managing multiple R versions on the same machine, we recommend rig.)

tm-89 commented 5 hours ago

Can you say more about how/why you say you have installed R 4.2, 4.3, and 4.4 all on your machine? Do you mean all at the same time, or first you installed R 4.2, then later replaced it with R 4.3, etc? It is not typically possible or recommended to install and use multiple regular R installations from CRAN, especially on macOS.

(If you are interested in managing multiple R versions on the same machine, we recommend rig.)

I just updated R and the old versions weren't deleted. I'm just using the latest one.

jennybc commented 41 minutes ago

Something feels confused/dysfunctional around your R installation. For example, did you upgrade R but then somehow keep using the previous package library? Whenever you go from one minor version to the next, such as 4.3 to 4.4, you need to reinstall all add-on packages.

To reiterate:

What does .libPaths() return for you in Positron and in RStudio?

I'll also add: what does sessionInfo() show?

We are interested in seeing the exact output of these functions. E.g. for me it's:

sessionInfo()
#> R version 4.4.1 (2024-06-14)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Ventura 13.7
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: America/Vancouver
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_4.4.1    fastmap_1.2.0     cli_3.6.3         tools_4.4.1      
#>  [5] htmltools_0.5.8.1 withr_3.0.1       fs_1.6.4          glue_1.8.0       
#>  [9] yaml_2.3.10       rmarkdown_2.28    knitr_1.48        reprex_2.1.1.9000
#> [13] xfun_0.47         digest_0.6.37     lifecycle_1.0.4   rlang_1.1.4      
#> [17] evaluate_1.0.0

.libPaths()
#> [1] "/Users/jenny/Library/R/arm64/4.4/library"                            
#> [2] "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library"

Created on 2024-10-16 with reprex v2.1.1.9000