Issues while Installing Caret - r

All,
When I try to install the library(caret), I get the following error
library(caret)
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘pkgconfig’
Error: package ‘ggplot2’ could not be loaded
When ggplot2 is installed separately, it says the following but still not able to load ggplot2
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\b_umair\AppData\Local\Temp\Rtmpym8OBL\downloaded_packages
I am using R version 4.0.2 and have tried majority of the options listed on the internet
Any suggestions on how to resolve this issue??

Related

Trouble With Package "ade4"

Hello I've been trying to use the library package "adegenet" and while the package seems to be installed when I try to run the library("adegenet") I get an error message telling me that some problem has occured with ade4. Here is the code up to the error message:
Package ‘adegenet’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\esteb\AppData\Local\Temp\RtmpGm98iy\downloaded_packages
> library("adegenet")
Loading required package: ade4
Error: package or namespace load failed for ‘ade4’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘vctrs’ 0.2.0 is being loaded, but >= 0.2.1 is required
Error: package ‘ade4’ could not be loaded
In addition: Warning messages:
1: package ‘adegenet’ was built under R version 3.6.3
2: package ‘ade4’ was built under R version 3.6.3
I couldn't quite find anything online to explain what's going on here. Any help appreciated

Why am I getting an error while trying to load caret package?

I tried:
library(caret)
then I got the error:
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.3.0.1 is already loaded, but >= 0.3.1 is required
Error: package ‘ggplot2’ could not be loaded
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.5.3
so I tried updating the ggplot2 using:
install.package("ggplot")
even after that I am getting the same error. my caret package is also updated.
I think you can try two things. One is updating your R version (and Rstudio version?). The other can be updating ggplot2 with dependencies:
install.packages('ggplot2', dependencies = TRUE)

How to repair R car package failure to load?

After attempting to install R openxlsx package, car package now fails to load. How do I repair R car package load error (R version 3.5.2.)?
I have checked imports/dependencies for the car package - openxlsx present.
So how the message below can be fixed?
library(car)
Error: package or namespace load failed for ‘car’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘openxlsx’
Try install.packages("openxlsx").
Dependencies have to be mentioned explicitly when you create a package, and it happens all the time that authors forget some.

Error using library(caret) in RStudio

I have been trying to use caret library for a simple ML application. I am using the latest versions of R (3.4.3) and RStudio (1.1.414). Here is my approach
install.packages("caret",repos = "http://cran.r-project.org", dependencies = c("Depends", "Imports", "Suggests"))
when I run the code library(caret) I get the following error
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
Now I went forward and installed the packages that it suggests one by one i.e., DEoptimR, gower, etc. This list never ends as once I install a package it will ask for another package. I am so frustrated. I have literally looked up in every forum but it did not solve my problem. I am not sure why the code install.package does not install all the required packages even though I ask explicitly to do so. when I check .libPaths() I can see it has access to both my library directories
[1] "C:/Users/omid/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.3/library"
would anyone be able to help please?
Edit 1:
install.packages("caret",repos = "https://cran.r-project.org", dependencies = c("Depends", "Imports"))
Installing package into ‘C:/Users/omidm/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/bin/windows/contrib/3.4/caret_6.0-78.zip'
Content type 'application/zip' length 5155777 bytes (4.9 MB)
downloaded 4.9 MB
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\omidm\AppData\Local\Temp\RtmpGuZ1vH\downloaded_packages
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
I also uninstalled R and RStudio and installed them again. Still getting the same error.
Solved:
I managed to solve this issue somehow, however, I am still not sure how. here is what I did
Open R GUI (not RStudio) and run:
install.packages("installr") # install
installr::updateR() # updating R
type q() to exit and then open RStudio. Go to Packages and Update all packages
Install package caret as per comments from #chinsoon and #Ronald
install.packages("caret", dependencies=c("Depends", "Imports"))
if you still get an error about any package just install that one. It will not ask for any other packages as you have removed "Suggest" from dependencies. Hope this manages to solve some people's problem.
Easy and simply:
install.packages("gower")
library(caret)
omg! yes ive been trying to find a solution for days! basically install anything it asks. I had to do the following
install.packages("gower")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘hardhat’
install.packages("hardhat")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘parallelly’
install.packages("parallelly")
then ran library(caret) and it worked

Installing Caret and ggplot2 packages in R 3.2.5

I've just installed a new version of R studio 3.2.5 that way I can install packages caret and ggplot2 however I always come across the same errors and not exactly sure where the problem is.
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package ‘ggplot2’ could not be loaded**
After this message I've install.packages("ggplot2")
and this shows up
library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’**
Does anyone have any suggestions?
try this
install.packages("ggplot2", dependencies = TRUE)
I have also got the same error and i tried many ways given in various solutions.
one solution which worked is
install.packages("stringi")
Then it many give errors stating some of the dependent libraries are missing.
Install those libraries, it will work.

Resources