package car unable to load, wrong version of nlme
Asked Answered
W

2

8

When I try to load the 'car' package I get this error:

library(car)

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'nlme' 3.1-122 is already loaded, but >= 3.1.123 is required
Error: package or namespace load failed for 'car'

But when I run update.packages() there is nothing to update. I'm using MRO 3.2.3 if that matters.

Waw answered 17/2, 2016 at 22:52 Comment(2)
The required version might not be available for your version of R?Comanche
The problem seems to be that somehow an old version of nlme is part of r-base and is loaded instead of the new version which would be normally loaded if you just load nlme via library(). One solution could be to load nlme before manually when the wrong version is not loaded yet.Macronucleus
M
4

I had the same problem and solved it simply by installing nlme_3.1-123.tar.gz from https://cran.r-project.org/src/contrib/Archive/nlme/

Masse answered 27/2, 2016 at 10:32 Comment(0)
D
2

The ultimate cause of your problem is most likely that MRO defaults to a static repository:

By default, Microsoft R Open offers its users predictability using a static CRAN snapshot date. For example, the CRAN repository for Microsoft R Open 3.2.3 is configured to point to a snapshot date of Jan 1, 2016. Consequently, with Microsoft R Open 3.2.3 you'll always get packages as they were at midnight UTC on Jan 1, 2016 by default whenever you use install.packages.

Using a fixed CRAN repository snapshot means that every user of Microsoft R Open has access to the same set of CRAN package versions. This makes sharing R code that relies on R packages easier, and reduces the chance of incompatible R packages being installed on the same system. Learn more about fixed CRAN repository snapshots.

Try

install.packages("nlme",repos="http://cran.r-project.org")

or possibly

install.packages("nlme",repos="http://cran.r-project.org",type="binary")

(if you get a type == "both" cannot be used ... error).

Another possible source of problems with new versions of recommended packages is that one may have the old version installed in a system-level package directory, while the new version is installed in a user-level directory; check the results of

sapply(.libPaths(),packageVersion,pkg="nlme") 

and consider adding something like lib=.libPaths()[2] to your install.packages() call.

Disentangle answered 4/3, 2016 at 2:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.