2

I wanted to run some code that uses the 'rethinking' library. As instructed there, I first installed rstan, which went fine, then typed

install_github("rmcelreath/rethinking")

The latter gives the errors:

Error: package or namespace load failed for 'ggplot2' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace 'ellipsis' 0.3.1 is being loaded, but >= 0.3.2 is required
Error: package 'ggplot2' could not be loaded
In addition: Warning messages:
1: package 'rstan' was built under R version 4.0.5 
2: package 'StanHeaders' was built under R version 4.0.5 
3: package 'ggplot2' was built under R version 4.0.5 
Execution halted
ERROR: lazy loading failed for package 'rethinking'
* removing 'C:/Program Files/R/R-4.0.3/library/rethinking'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\curl\libs\x64\curl.dll to C:\Program Files\R\R-4.0.3\library\curl\libs\x64\curl.dll: Permission denied
2: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\ps\libs\x64\ps.dll to C:\Program Files\R\R-4.0.3\library\ps\libs\x64\ps.dll: Permission denied
3: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\ellipsis\libs\x64\ellipsis.dll to C:\Program Files\R\R-4.0.3\library\ellipsis\libs\x64\ellipsis.dll: Permission denied
4: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\digest\libs\x64\digest.dll to C:\Program Files\R\R-4.0.3\library\digest\libs\x64\digest.dll: Permission denied
5: In i.p(...) :
  installation of package ‘C:/Users/User/AppData/Local/Temp/RtmpAfQQaY/file1268133e3024/rethinking_2.13.tar.gz’ had non-zero exit status
> source("~/.active-rstudio-document", echo=TRUE)

Indeed, if I try to run code from the library, I get:

> library(rethinking)
Error in library(rethinking) : there is no package called ‘rethinking’

I am running Rstudio 2021.09.0 as administrator, on Windows 10.

I also tried installing the library from the Packages|Install button, but that gives

> install.packages("rethinking")
Warning in install.packages :
  package ‘rethinking’ is not available for this version of R

The solutions suggested here did not work for me. Any help would be appreciated!

EDIT: for solution, please see comments - thanks for the replies!

z8080
  • 571
  • 3
  • 7
  • 23
  • 1
    The first error appears to be that the version-dependency on `ellipsis` was not met. What happens when you `install.packages("ellipsis")` and then try again? (FYI, windows and spaces-in-paths can be a problem, see https://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-install-R-for-Windows_003f. For my use, I install R under `C:/R/R-4.0.5/` and don't use `C:/Program Files/...` for that; similarly, `C:/Rtools40/`. – r2evans Oct 28 '21 at 17:00
  • Permission denied is an odd error to see. Do you have more than one copy of R running? What if you restart your machine and try the install again? Do the install before loading any existing packages. – MrFlick Oct 28 '21 at 17:08
  • Installing ellipsis separately didn't change anything. I don't have more than one R copy, but I think the space in 'Program Files' may be the root problem, according to what I [see](https://imgur.com/a/1LATyWc) in my Preferences. – z8080 Oct 29 '21 at 08:16
  • 1
    I uninstalled Rstudio and R, and reinstalled in a path without spaces, as @r2evans suggested. The installation of the package worked well afterwards. Thank you!! – z8080 Oct 29 '21 at 09:11

0 Answers0