posit-dev / positron

Positron, a next-generation data science IDE
Other
1.18k stars 32 forks source link

package or namespace load failed for ‘dplyr’ in dyn.load #3732

Open dsolito opened 4 days ago

dsolito commented 4 days ago

Hello, thanks for this new IDE. I was expecting this for so long time. First try here on macOS Sonoma 14.3.1. Intel (macBookPro)

I am using vscode for 1 year now and everything run smootlhy. After Positron install, I try to load some libraries but it fails. I checked the R version and .libPaths and both IDE have the same values.

Here the error message :

image

What can I do?

JulianRamajo commented 3 days ago

I received the same error message when I try to load the "tydverse" library:

library(tidyverse) Error: ! package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...): no es posible cargar el objeto compartido '/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so': dlopen(/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libR.dylib Referenced from: <270B8E9B-4B07-38A5-8F07-D40F024B1184> /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so Reason: tried: '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libR.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libR.dylib' (no such file), '/usr/local/lib/libR.dylib' (no such file), '/usr/lib/libR.dylib' (no such file, not in dyld cache) Hide Traceback ▆

  1. └─base::library(tidyverse)
  2. └─base::tryCatch(...)
  3. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  4. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
  5. └─value[3L]
lionel- commented 2 days ago

It looks like some macOS distributions of R packages do not link to R with an absolute path and we'll need to reintroduce DYLD_FALLBACK_LIBRARY_PATH which we removed in https://github.com/posit-dev/positron/pull/2083. I.e. we'll need the same fix as for Linux: https://github.com/posit-dev/positron/pull/2809.

We'll have to do the same in Ark's kernel spec and make sure generated binaries are signed with appropriate entitlements.

To confirm this @dsolito and @JulianRamajo, could you please run otool -L path/to/pkg-lib.so in the terminal and give us the output? For instance in Julian's case it would be:

 otool -L /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so
JulianRamajo commented 2 days ago

First of all, thank you for the quick response. Below are the requested data. I'm using Positron on macOS Ventura 13.6.7. Intel (MacBook Pro).

MacBook-Pro-de-Julian:~ julian_ramajo$ otool -L /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so
/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/magrittr/libs/magrittr.so:
    magrittr.so (compatibility version 0.0.0, current version 0.0.0)
    /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libR.dylib (compatibility version 4.3.0, current version 4.3.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1775.118.101)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
dsolito commented 2 days ago

Thank you for your message @lionel- Please find the result of the query :

otool -L /usr/local/lib/R/4.3/site-library/magrittr/libs/magrittr.so

/usr/local/lib/R/4.3/site-library/magrittr/libs/magrittr.so:
        magrittr.so (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/r/lib/R/lib/libR.dylib (compatibility version 4.3.0, current version 4.3.2)
        /usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 13.0.0, current version 13.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1971.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)