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

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:
> library(prophet)
> 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/prophet.so':
> dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet.so,
> 6): Library not loaded: #rpath/libtbb.dylib Referenced from:
> /Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet.so
> Reason: image not found
R version is R version 4.0.2, Built for Catalina

try library(rstan) before library(prophet)
https://github.com/facebook/prophet/issues/464

Related

Error loading R package - libicui18n.so.68: cannot open shared object file

Until yesterday, I could run library(car) just fine. But after running yay -Syyu and upgrading as many packages as I can, this no longer works.
> library(car)
Loading required package: carData
Error: package or namespace load failed for ‘car’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/my-name/R/x86_64-pc-linux-gnu-library/4.0/stringi/libs/stringi.so':
libicui18n.so.68: cannot open shared object file: No such file or directory
I am running this on Arch Linux.
We can install the 'stringi' package
install.packages('stringi')

How to fix error loading tidyverse library

I am having trouble loading the tidyverse library. I am new to R. After installing packages using:
install.packages("tidyverse",dependencies = TRUE)
No problem thus far... but then I try to load the tidyverse library:
library(tidyverse)
I get the following:
Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: ___cxa_uncaught_exceptions
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
Expected in: /usr/lib/libc++abi.dylib
in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
I have tried installing and uninstalling R, with no effect.
I'm using Version 1.1.463 – © 2009-2018 RStudio, Inc. for use with OS X El Capitan Version 10.11.4.

RWeka installation under Rstudio on Mac

I tried to find solutions from previous posts, but they do not solve my problem.
I am using macOS High Sierra and have Java installed. Below is the error reported by Rstudio. Also, rJava, Mac, and R are really messy with each other. I found this post but still does not work.
https://github.com/MTFA/CohortEx/wiki/Run-rJava-with-RStudio-under-OSX-10.10,-10.11-(El-Capitan)-or-10.12-(Sierra)
///////////////////
library(RWeka)
Error: package or namespace load failed for ‘RWeka’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
In addition: Warning message:
package ‘RWeka’ was built under R version 3.4.4
I met the same question and I found this is helpful.
Cannot load R xlsx package on Mac OS 10.11
1.In terminal enter the following to relink Java correctly:
sudo R CMD javareconf
2.Back in R (or RStudio) install the rJava package from source:
install.packages("rJava",type='source')
Then
library(rJava)
and
library(RWeka)
should work.

R: cannot install packages after downgrading from 3.5 to 3.4. Error in dyn.load(file, DLLpath = DLLpath, ...)

I had installed R 3.5.1 as detailed in here, but I had some problem with some packages (namely rJava and XML), so I have decided to uninstall R 3.5.1 and downgrade to R 3.4.4 from the Ubuntu 18.04 repositories.
I did that successfully, but now, when I try to reinstall any CRAN package inside R with, for example:
install.packages("ggplot2")
library(ggplot2)
I get the following errors:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so':
/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so: undefined symbol: DATAPTR
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/usr/local/lib/R/site-library/ggplot2’
* restoring previous ‘/usr/local/lib/R/site-library/ggplot2’
The downloaded source packages are in
‘/tmp/RtmpFKBMdd/downloaded_packages’
Warning message:
In install.packages("ggplot2") :
installation of package ‘ggplot2’ had non-zero exit status
>
>
>
>
> library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so':
/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so: undefined symbol: DATAPTR
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.5.1
Any clue how to solve this? Thanks
OK this script to remove all user installed packages works like a charm if anyone is interested. It was taken from here.
# Shamlessly stolen from:
# https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/
# create a list of all installed packages
ip <- as.data.frame(installed.packages())
head(ip)
# if you use MRO, make sure that no packages in this library will be removed
ip <- subset(ip, !grepl("MRO", ip$LibPath))
# we don't want to remove base or recommended packages either\
ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]
# determine the library where the packages are installed
path.lib <- unique(ip$LibPath)
# create a vector with all the names of the packages you want to remove
pkgs.to.remove <- ip[,1]
head(pkgs.to.remove)
# remove the packages
sapply(pkgs.to.remove, remove.packages, lib = path.lib)

ggplot2 package failing to load

I just recently updated my Rstudio to the 0.98.1103 release and now I'm unable to load ggplot it keeps throwing the following error. Any ideas what is going on?
> library(ggplot2)
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/X11/lib/libXft.2.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: image not found
Error: package or namespace load failed for ‘ggplot2
I tried removing the tcltk library and ggplot2 and reinstalling them now I'm getting a different set of errors:
> library(ggplot2)
Error : package ‘tcltk’ does not have a namespace
Error: package or namespace load failed for ‘ggplot2’
> library(tcltk)
Error in library(tcltk) : ‘tcltk’ is not a valid installed package
Seems like X11 is not installed on your system. Try installing xorg (if you're running Linux) or XQuartz if you're on OSX.

Resources