package or namespace load failure - r

I don't know what happened but this NAMESPACE LOAD FAILURE is coming every time I call the forecast package.
So I have used this line of code
install.packages("forecast",repos = c("http://rstudio.org/_packages",
"http://cran.rstudio.com"))
This was the console message that I got after running this code
Installing package into ‘C:/Users/adarsh/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository
http://rstudio.org/_packages/bin/windows/contrib/3.5:
cannot open URL
'http://rstudio.org/_packages/bin/windows/contrib/3.5/PACKAGES'
There is a binary version available but the
source version is later:
binary source needs_compilation
forecast 8.6 8.7 TRUE
Binaries will be installed
trying URL
'http://cran.rstudio.com/bin/windows/contrib/3.5/forecast_8.6.zip'
Content type 'application/zip' length 2345112 bytes (2.2 MB)
downloaded 2.2 MB
package ‘forecast’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\adarsh\AppData\Local\Temp\RtmpQ58pju\downloaded_packages
I checked whether this was also the case with other packages.
install.packages("tseries")
Installing package into ‘C:/Users/adarsh/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘quadprog’ is not available
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/tseries_0.10-46.zip'
Content type 'application/zip' length 414767 bytes (405 KB)
downloaded 405 KB
package ‘tseries’ successfully unpacked and MD5 sums checked**
**The downloaded binary packages are in
C:\Users\adarsh\AppData\Local\Temp\RtmpQ1vu1H\downloaded_packages**
library(tseries)
Error: package or namespace load failed for ‘tseries’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘quadprog’
In addition: Warning message:
package ‘tseries’ was built under R version 3.5.3
Same error happened again. Please anyone help me.

I downloaded the " quadprog " package from the cran repository and saved it as zip file at C://Users/yourname/Documents/package_file.zip .
Then used the option Package Archive File (.zip; .tar.gz) in R studio and installed the above package.
Thank you

Related

Install/Compiling Errors with R Packages: tidyverse and caret

I recently had to install RStudio and the R language onto a new Macbook. It seemed to install the packages normally but when I started run some newly written code, the console would not execute tidyverse and caret even though it said it was downloaded. This is what shows up in the console and it's the same messages for both caret and tidyverse:
> install.packages("tidyverse")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/tidyverse_1.3.1.tgz'
Content type 'application/x-gzip' length 421072 bytes (411 KB)
==================================================
downloaded 411 KB
The downloaded binary packages are in
/var/folders/pl/w9k_0l4d4snfgcv53rp2t_4m0000gn/T//RtmpWScbjK/downloaded_packages
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Rcpp’
I even tried to install it on just R and not RStudio too and This is the message that comes up for both tidyverse and caret when I try to install Rcpp both ways on just R and RStudio:
> install.packages("Rcpp")
There is a binary version available but the source version is later:
binary source needs_compilation
Rcpp 1.0.8.2 1.0.8.3 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
installing the source package ‘Rcpp’
trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_1.0.8.3.tar.gz'
Content type 'application/x-gzip' length 3086192 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp’
The downloaded source packages are in
‘/private/var/folders/pl/w9k_0l4d4snfgcv53rp2t_4m0000gn/T/Rtmp53AysU/downloaded_packages’
Warning message:
In install.packages("Rcpp") :
installation of package ‘Rcpp’ had non-zero exit status
I'm not sure what's going wrong and I'm not seeing any solution on here or other sites that are working for me, I'd appreciate any help with this since I use R alot. If more info is needed please comment, thanks.
It could be that you need to reinstall the rlang package. You can use this code to reinstall this package:
remove.packages("rlang")
install.packages("rlang")
After that you can load the packages tidyverse and caret again:
library(tidyverse)
library(caret)
Check this question for more info: Error: package or namespace load failed for ‘tidyverse’ in loadNamespace

I am unable to install ggplot, there occurs some error

there is this long error message when i try to install ggplot, please someone help me. Thanks!
install.packages("ggplot2")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.3.4 1.0.1 TRUE
ggplot2 3.1.1 3.3.5 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/rlang_0.3.4.zip'
Content type 'application/zip' length 1080437 bytes (1.0 MB)
downloaded 1.0 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8\downloaded_packages
installing the source package ‘ggplot2’
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
downloaded 2.9 MB
installing source package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'rlang' 0.3.4 is being loaded, but >= 0.4.10 is required
ERROR: lazy loading failed for package 'ggplot2'
removing 'C:/Users/HP/Documents/R/win-library/3.4/ggplot2'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.1/bin/i386/R" CMD INSTALL -l "C:\Users\HP\Documents\R\win-library\3.4" C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8/downloaded_packages/ggplot2_3.3.5.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8\downloaded_packages’
It's saying your "rlang" version is outdated. Update that, it should be fine. Update all the libraries, that's a good practice while installing packages. (you do the same from tool option in menubar of Rstudio and update package)

Installing package in R: there is no package called ‘gsl’

I tried to install package copula but incurred error.
I first installed package copula, then tried:
library(copula)
and get:
Show in New WindowClear OutputExpand/Collapse Output
Error: package or namespace load failed for ‘copula’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘gsl’
Then I installed package gsl, restarted R, and tried, following this similar issue:
if(!require(pacman)) install.packages("pacman")
pacman::p_load(copula)
which didn't seem to work. I'm using macOS Big Sur OS.
Edit:
install.packages("gsl")
returned:
There is a binary version available but the source version is later:
Warning in install.packages :
cannot open compressed file '/Users/xxx/.rstudio-desktop/notebooks/3D993D5E-filename/1/8FD36A93A05DA0F7/c6uz0e7whq1or_t/_rs_rdf_111422764b18d.rdf', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
Update:
On 18/05/21, tried
install.packages("copula")
library(copula)
and caught error below:
> install.packages("copula")
also installing the dependency ‘gsl’
There is a binary version available but the source version is later:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Y
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/copula_1.0-1.tgz'
Content type 'application/x-gzip' length 7335219 bytes (7.0 MB)
==================================================
downloaded 7.0 MB
The downloaded binary packages are in
/var/folders/ll/dvpphrys0pddnjffq7zbl7vm0000gn/T//RtmpRUGsKi/downloaded_packages
installing the source package ‘gsl’
trying URL 'https://cran.rstudio.com/src/contrib/gsl_2.1-6.tar.gz'
Content type 'application/x-gzip' length 189794 bytes (185 KB)
==================================================
downloaded 185 KB
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/ll/dvpphrys0pddnjffq7zbl7vm0000gn/T/RtmpRUGsKi/downloaded_packages’
> library(copula)
Error: package or namespace load failed for ‘copula’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gsl’
Download Homebrew then run
if(!require(pacman)) install.packages("pacman")
pacman::p_load(copula)
seems working for me :)

I can't seem to install the 'ecospat' package on R studio for windows

I am unable to install the 'ecospat' package on R and I was wondering why this could be?
After running the following bit of code using R in windows.....
install.packages('ecospat')
This is the error message I get...
Installing package into ‘C:/Users/etelford.IC.000/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘pROC’, ‘biomod2’
There are binary versions available but the source versions are later:
binary source needs_compilation
pROC 1.14.0 1.16.2 TRUE
biomod2 3.3-7.1 3.4.6 FALSE
ecospat 3.0 3.1 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/pROC_1.14.0.zip'
Content type 'application/zip' length 941305 bytes (919 KB)
downloaded 919 KB
package ‘pROC’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\etelford.IC.000\AppData\Local\Temp\RtmpsBJC01\downloaded_packages
installing the source packages ‘biomod2’, ‘ecospat’
trying URL 'https://cran.rstudio.com/src/contrib/biomod2_3.4.6.tar.gz'
Content type 'application/x-gzip' length 665227 bytes (649 KB)
downloaded 649 KB
trying URL 'https://cran.rstudio.com/src/contrib/ecospat_3.1.tar.gz'
Content type 'application/x-gzip' length 2179055 bytes (2.1 MB)
downloaded 2.1 MB
installing source package 'biomod2' ...
** package 'biomod2' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'pROC' 1.14.0 is being loaded, but >= 1.15.0 is required
ERROR: lazy loading failed for package 'biomod2'
removing 'C:/Users/etelford.IC.000/Documents/R/win-library/3.4/biomod2'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\etelford.IC.000\Documents\R\win-library\3.4" C:\Users\ETELFO~1.000\AppData\Local\Temp\RtmpsBJC01/downloaded_packages/biomod2_3.4.6.tar.gz' had status 1
Warning in install.packages :
installation of package ‘biomod2’ had non-zero exit status
ERROR: dependency 'biomod2' is not available for package 'ecospat'
removing 'C:/Users/etelford.IC.000/Documents/R/win-library/3.4/ecospat'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\etelford.IC.000\Documents\R\win-library\3.4" C:\Users\ETELFO~1.000\AppData\Local\Temp\RtmpsBJC01/downloaded_packages/ecospat_3.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ecospat’ had non-zero exit status
Any help would be greatly appreciated,
thanks
First of all you need to update your R version. I think you use an R 3.4 version.
The main reason why your installation fails is that you need to install pROC > 1.15 and this is not available for R 3.4.

R Package installed but cannot be loaded?

I installed the "digest" package in R.
> install.packages("digest")
Installing package into ‘C:/Users/user/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://mran.microsoft.com/snapshot/2017-03-15/bin/windows/contrib/3.3/digest_0.6.12.zip'
Content type 'application/zip' length 172746 bytes (168 KB)
downloaded 168 KB
package ‘digest’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘digest’
The downloaded binary packages are in
C:\Users\user\AppData\Local\Temp\RtmpaMPhK6\downloaded_packages
I confirmed that this package is installed in:
C:\Program Files\R\R-3.3.2\library\digest
My repos are:
getOption("repos")
CRAN CRANextra
"https://mran.microsoft.com/snapshot/2017-03-15" "http://www.stats.ox.ac.uk/pub/RWin"
Then I wanted to install "kableExtra" package. But I am getting an error message that the there is no "digest":
> library(kableExtra)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘digest’
Error: package or namespace load failed for ‘kableExtra’
What is wrong? Is this due to the fact that the original library is from CRAn, but for some reason this "digest" package is coming from MRAN? How can I fix this?

Resources