Loading Path Library Path Issue (I think)?

This is a super frustrating problem - I cant load tidyverse, readr, and most other packages. I think the issue is with where the packages are loaded and where I am working? No clue though, I pretty terrible at this. The issue is ---

library(tidyverse)

Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so': dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: _EXTPTR_PTR Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so Expected in: /Library/Frameworks/R.framework/Resources/lib/libR.dylib in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so

Here are some things about the libs and where they are (I think, not sure I found them looking at what others did to fix this).

Sys.getenv("PATH")
Sys.which("stats.dll") 
.libPaths()

[1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/RStudio.app/Contents/MacOS/postback:/Users/rastkostojsin/Library/TinyTeX/bin/x86_64-darwin"
stats.dll
""
[1] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"

Ive seen that others have had similar issues and have solved them, but I have no idea what anyone is talking about in the chat (not super computer literate). Any help would be appreciated :slight_smile: cheers

OK, let's put together the pieces.

  1. Which version of macOS are you running?
  2. Did you install R from the cran site, rather than with brew?
  3. If so, did you install the "notarized" version?
  4. When you ran the installer pkg, did you have to enter a password?
  5. Do the .so filles under /Library/Frameworks/R.framework/Versions/4.0/Resources/library/libs exist? Rcpp.so, etc?
  6. Can you run the R GUI?
  7. Can you run the R Console pane in RStudio?
  8. In either of those what happens if you type library(Rcpp) ?
  1. macOS version 10.14.6
    2-4. not sure I installed it over a year ago
  2. Not sure if they are .so files. Not even sure what .so are. But all the libraries are there including Rcpp.
  3. If I open just R console, I get the same error when trying library(Rcpp)
  4. I can run R console pane in Rstudio, again same error as above though
  5. same error as with library(tidyverse) for both

It seems like the librarys exist but R/Rstudio cant seem to link to them

Each of the directories represent an R package, and underneath each is a directory called lib, which is where the .so files would be. They are probably there; otherwise the creation times on the folders shown wouldn't have been updated. You can check by expanding the folder for Rcpp.

The directory tree shown is the system version, for all users. There's a separate user specific directory under your home directory: /Users/YOURUSERNAMEHERE/Library/R/4.0/library. If that exists and there is no Rcpp subdirectory, that is evidence that RStudio is looking in the wrong place for packages with which to build tidyverse.

Check if you have a user version and we'll try to figure out how to get R to switch to the system version, instead.

Also, from the terminal, could you post the results of

$ echo $PATH

please?

macOS versions. There is usually no pressing need to keep up with the x.x.x.y changes, say from 10.14.2.1 to .2. It's generally a good idea to keep up with 10.14.2 to 10.14.3. You risk growing difficulties by not going from 10.14 to 10.15.

I checked within the Rcpp folder in the screenshot above - there is .so files!

following my /Users/MyName/ path I don't seem to have a Library folder there so I cant follow that directory you mention.

Results of

$ echo $PATH

in termnial ---
(base) MY-MacBook-Pro:~ MYNAME$ echo $PATH
/Users/MYNAME/opt/miniconda3/bin:/Users/MYNAME/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

Which all seems related to python not R?

Ah, anaconda. I love it to death. It's a great package manager for Python, but it's been a frequent source of trouble for R. They need a divorce. So, uninstall R with Anaconda.

Then, go to CRAN and download the macOS version called R-4.0.2.pkg (notarized and signed)

Install it for "all users" and report back?

1 Like

@technocrat mate - this worked perfectly!!! Thank you so much, you are a hero.

Finally I can get back to work.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.