I've installed a fresh copy of RStudio on a shiny new Windows notebook.
However, few if any of the installed packages are working successfully, perhaps due to a failure to install needed dependencies.
Steps taken so far -
Installed RStudio on a fresh laptop
Deselected Tools > Global Options > Restore .RData into workspace at startup
quit and Restarted RStudio
used "Install Packages" from menu to install a package, being sure to select "Install Dependencies"
once that appears to succesfully execute, I call the package with library(), which then complains that dependencies are missing.
Here's an example using the package 'plm'
"Install Packages" produces and runs the code
install.packages("plm")
producing the output
Installing package into ‘C:/Users/00011124/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/plm_2.2-2.zip' Content type 'application/zip' length 1679303 bytes (1.6 MB) downloaded 1.6 MB
package ‘plm’ successfully unpacked and MD5 sums checked
Error: package or namespace load failed for ‘plm’ in library.dynam(lib, package, package.lib): DLL ‘zoo’ not found: maybe not installed for this architecture?
Suggestions gratefully received.
System Information:
RStudio Edition: Desktop
RStudio Version: 'Orange Blossom' 1.2.5033
OS Version: Win 10 x64
R Version: 3.6.2 (2019-12-12)
Also:
Your sessionInfo(): R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362)
Error: package or namespace load failed for ‘plm’ in library.dynam(lib, package, package.lib): DLL ‘lmtest’ not found: maybe not installed for this architecture?
Can you install this one too, restart your session and try again?
You are going to have to repeat this process until there are no package dependencies missing.
Andresrcs, I appreciate your effort, but the point is
The problem is not just getting one package to run; the problem is getting a wide range of packages to run
package installation is supposed to track and automatically install dependencies...and has always done so for me in previous configurations. Something is systematically wrong here that needs fixing.
Not by default, you can try setting dependencies = TRUE while installing but very likely this is going to happen from time to time, that is why this forum has lots and lots of topics like yours.
My reading of the manpage for install.packages() is that dependencies = NA is the default, , and it states The default, NA, means c("Depends", "Imports", "LinkingTo")
I noted at the outset that when installing packages through the menu system, I selected the "install dependencies" option.
I don't think the dependencies are being installed, despite this.
I think you agree.
After a bit more troubleshooting, I found the following to work.
install.packages("plm",dependencies = TRUE)
Despite having previously tried to install the plm package with the default dependencies = NA, using dependencies = TRUE as andresrcs previously suggested installed roughly 40 new packages. However, then trying
library(plm)
produced evidence of more missing dependencies
DLL ‘lmtest’ not found: maybe not installed for this architecture?
Following this with
install.packages("lmtest",dependencies = TRUE)
installed an additional 3 packages. After restarting R with Ctrl-Shift-F10
library(plm)
then worked correctly.
Lesson learned: don't trust the default dependencies = NA, use dependencies=TRUE and iterate as required, restarting R to clear warnings that lazy-load database XXXXXXX is corrupt
Question to long time R experts on the forum, is this issue something like install.packages() doing a reasonable job of identifing and ordering top level dependencies and imports , but not tackling dependencies of dependencies, a la , a recursive scheme ? or would it normally try to do that ?
Browsing around, I saw that someone had make an explicit approach to try to track all dependencies down the tree, is that to plug a known gap with install.packages. or is this a misunderstanding ?
I'm admittedly the opposite of a long time R expert, but as a casual user for > 5 yrs, I've never run into this kind of dependency problem using earlier versions of RStudio. In contrast, with the current version I'm running into this with most packages that I try to install.
This appears to be a previously solved problem that has resurfaced.
Not in my experience, this kind of installation problems happen all the time and I honestly can't remember any moment since I use R where this sort of things weren't an issue.
I suspect that the hassle free installation experience that you remember was related to you having a package library with a lot of the package dependencies already installed thus avoiding this kind of problems but since you updated your setup that is no longer the case right now, but after some installation processes you are going to start getting the same experience as before.