Caret installation error

Hello everyone,

I'm trying to install the "caret" package and whatever I do it gives me always the following error:

Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
object 'vI' not found

I already uninstall and installed back again R and RStudio. I also tried to installed the caret dependencies and it simply doesn't work. I read everything I could in blogs and communities and I have no idea what to do more.
I hope you can help me.

Kind Regards,

Are you installing caret via install.packages()? What's the full output when you install the package (i.e. not just the error you posted)? What type of system are you on? (The output of sessionInfo() from a fresh R session will provide those details).

1 Like


Thank you for your reply.
Yes, I'm installing caret via install.packages().
After the installation it says it downloaded correctly caret into temporary files.
I copy all the files downloaded for caret and I paste them in the R library (where I also unzip them) .
I do this because anything that is downloaded in temporary files, disappears after a while.

Then, when I try to call caret through library(caret), or even through, require(caret), the error message appears. Just that error, nothing else.

The output of sessionInfo() is as follows:

R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Thank you in advance.

Is manually copying package files part of your usual package installation process?

install.packages() should do that for you (although I have worked in corporate environments where some manual moving of files was necessary, hence why I ask).

Yes, I work as well in a corporate environment, and apparently everything we download by ourselves, goes to temporary files to avoid problems I believe.
I'm not as expert in systems, but I realized that I had to do this manual copying process, because every time I was installing a package to use, the next day was no longer accessible for use. Therefore, I had a look where RStudio was downloading and then I went there and I copy-paste in the R library. And it works, except for caret and apparently as well tidyverse.

Hmmm, that's going to make things a bit trickier, then, as I'm not sure exactly what else install.packages() will do for a large/complex package like caret.

What do the contents of the temporary directory you copy files out of look like?

The files that go to the temporary directory are zip files, which I unzip in the R library when I copy paste them.

Could you try specifying the installation location directly with the lib argument to install.packages()?


install.packages("caret", lib = "path/to/where/you/want/to/install")

Hello and sorry for my delayed answer!

I tried and it didn't work. It still downloads to the temp files.
Nevertheless, thank you for your effort.
I think I will have to search for other ways to the same things as the caret package does.

Thank you!

I suspect it's still possible to get it to work, if you have the patience for it.

If you can you provide the full output from install.packages("caret"), as well as the full error message you get when you try to library(caret) there may be a nugget of information there that will help!