Error: package or namespace load failed in Sweave project.

35 views
Skip to first unread message

Jorge Cimentada

unread,
Oct 7, 2017, 7:47:36 AM10/7/17
to packrat-discuss
Hi,

I have an Rstudio project that is built around a .Rnw Sweave file and where I recently installed a packrat project where everything ran smoothly. Everything is up-to-date, all packages are installed on my local packrat folder and packrat::on() is the default. Once I compile the .Rnw I get an error saying that one package (the car package) couldn't load because there is a dependency missing (mgcv is missing). More specifically the error raised is:

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 'mgcv'

Both packages load when running interactively (of course using .libPaths()[1], which is the packrat lib directory where both packages are successfully installed). The current library for the project is my_project/packrat/lib/x86_64-apple-darwin15.6.0/3.4.0. So the problem only occurs when compiling the .Rnw file (also note that other packages are loaded correctly before car, so this is a problem with this package and not the whole library being corrupt).

I tried installing mgcv and car before library(car) in the compilation but it raises the same error. Any ides where this might be coming from?

Jorge Cimentada

unread,
Oct 8, 2017, 4:47:57 PM10/8/17
to packrat-discuss
Update: I just created a packrat project on another Rstudio project (completely independent of the previous one) and I get exactly the same error with the car package.

Reply all
Reply to author
Forward
0 new messages