Rstudio cant install packages

Hi together :wave:

i am currently doing an introductory course in R but having trouble with Rstudio.
i want to install a package but just get a really, really long error.
Below is what i get in return but i'm already struggling to understand the first bit because i have got rtools installed

WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘cli’, ‘gtable’, ‘lifecycle’, ‘rlang’, ‘scales’, ‘vctrs’


  There are binary versions available but the source versions are later:
          binary source needs_compilation
cli        2.5.0  3.6.1              TRUE
gtable     0.3.0  0.3.4             FALSE
lifecycle  1.0.0  1.0.4             FALSE
rlang     0.4.11  1.1.2              TRUE
scales     1.1.1  1.3.0              TRUE
vctrs      0.3.8  0.6.4              TRUE
ggplot2    3.3.3  3.4.4             FALSE

  Binaries will be installed
versuche URL 'http://cran.rstudio.com/bin/windows/contrib/3.6/cli_2.5.0.zip'
Content type 'application/zip' length 534931 bytes (522 KB)
downloaded 522 KB

versuche URL 'http://cran.rstudio.com/bin/windows/contrib/3.6/rlang_0.4.11.zip'
Content type 'application/zip' length 1224139 bytes (1.2 MB)
downloaded 1.2 MB

versuche URL 'http://cran.rstudio.com/bin/windows/contrib/3.6/scales_1.1.1.zip'
Content type 'application/zip' length 561427 bytes (548 KB)
downloaded 548 KB

versuche URL 'http://cran.rstudio.com/bin/windows/contrib/3.6/vctrs_0.3.8.zip'
Content type 'application/zip' length 1289331 bytes (1.2 MB)
downloaded 1.2 MB

package ‘cli’ successfully unpacked and MD5 sums checked
package ‘rlang’ successfully unpacked and MD5 sums checked
package ‘scales’ successfully unpacked and MD5 sums checked
package ‘vctrs’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\User\AppData\Local\Temp\RtmpyQNsJZ\downloaded_packages
installing the source packages ‘gtable’, ‘lifecycle’, ‘ggplot2’

versuche URL 'http://cran.rstudio.com/src/contrib/gtable_0.3.4.tar.gz'
Content type 'application/x-gzip' length 130100 bytes (127 KB)
downloaded 127 KB

versuche URL 'http://cran.rstudio.com/src/contrib/lifecycle_1.0.4.tar.gz'
Content type 'application/x-gzip' length 107656 bytes (105 KB)
downloaded 105 KB

versuche URL 'http://cran.rstudio.com/src/contrib/ggplot2_3.4.4.tar.gz'
Content type 'application/x-gzip' length 3159578 bytes (3.0 MB)
downloaded 3.0 MB

* installing *source* package 'lifecycle' ...
** Paket 'lifecycle' erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Fehler in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace 'rlang' 0.4.11 is being loaded, but >= 1.1.0 is required
Ruft auf: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Ausführung angehalten
ERROR: lazy loading failed for package 'lifecycle'
* removing 'C:/Users/User/Documents/R/win-library/3.6/lifecycle'
Warning in install.packages :
  installation of package ‘lifecycle’ had non-zero exit status
ERROR: dependency 'lifecycle' is not available for package 'gtable'
* removing 'C:/Users/User/Documents/R/win-library/3.6/gtable'
Warning in install.packages :
  installation of package ‘gtable’ had non-zero exit status
ERROR: dependencies 'gtable', 'lifecycle' are not available for package 'ggplot2'
* removing 'C:/Users/User/Documents/R/win-library/3.6/ggplot2'
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\User\AppData\Local\Temp\RtmpyQNsJZ\downloaded_packages’
Warnmeldung:
In file.info(path, extra_cols = FALSE) :
  kann Datei 'C:/Users/User/AppData/Local/Microsoft/WindowsApps/PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0/python.exe' nicht öffnen: Das System kann auf die Datei nicht zugreifen´´´

What version of R are you running? You can check that by running the sessionInfo() function. Here is the beginning of the output I get for that. You can see I'm running R 4.3.1

> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

well, apparently i had an older version of R somewhere. just uninstalled everthing r related, reinstalled and it worked immediately...
Couldve saved myself 2 hours by trying that right away :face_with_spiral_eyes:
How did you notice that thats the issue tho?

The warning about RTools seems to appear most commonly when people are using an old version of R. Windows users with a current version of R should not need to compile packages from CRAN.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.