Error loading prophet library in R - How can I fix it?

Can someone help me to solve the prophet library loading for Mac in R? I have successfully installed the package, and when I try to load the library I get the following result:


> Error: package or namespace load failed for ‘prophet’
> in dyn.load(file, DLLpath = DLLpath, ...):  unable to load shared
> object
> '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/':
> dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/,
> 6): Library not loaded: @rpath/libtbb.dylib   Referenced from:
> /Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/
> Reason: image not found

R version is R version 4.0.2, Built for Catalina

Doest the file /Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/ exist on your system?

Edit: read that error message incorrectly. Is libtbb.dylib on your R_PATH?

Thank you for your answer grosscol. How can I check whether ibtbb.dylib is on my rpath?

In your R console or RStudio, you can invoke .libPaths() to get a list of where R will check for packages.

[1] "/home/grosscol/R/x86_64-pc-linux-gnu-library/dev" "/usr/local/lib/R/site-library"                   
[3] "/usr/lib/R/site-library"                          "/usr/lib/R/library" 

However, I don't think that's the problem looking more closely at it. @rpath isn't referring to R's library paths. That's an error being thrown from .so file which is a compiled library. It's looking for another library at runtime.

Found a neat description of that here:

@rpath stands for Run path search path. So it's a search path for the linker. Runtime Search Path instructs the dynamic linker to search a list of paths in order, to locate the dynamic library.

When you installed the package, was it built from source? If so, I think is not finding libtbb.dylib in the locations it was assumed it would be in. Does libttb.dylib exist anywhere on your system?

Seems like libttd.dylib does not exist anywere in my system.
The files and are located in a folder called libs.
Edit: the folder called libs is located in this path: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet

Interesting. I'm surprised the package successfully installed and did not check for it's dependencies in the locations it expected them to be.

Try Homebrew tbb package.

This assumes you have homebrew installed. There is a homebrew tbb package and I think that gets installed from your system's shell with:

brew install tbb

It might put the library in a location that is looking for it.

1 Like

grosscol - thank very much again for your help.

I finally managed to solve it by uninstalling r completely and installing an older version (3.6 instead of 4.0). Not sure what the exact issue was in the end

That sounds like it's an issue with the recent version of the prophet package. I would report the issue to their issue tracker.

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