RTools is not recognized by RStudio

Hello everyone,

I know, there are several other threads regarding this topic, but unfortunately none of them could help me.
I am using the desktop version of RStudio (latest version) and wanted to install the ggplot2 package.

After receiving an error I followed the instructions of other posts in this forum and installed RTools40. I followed the instructions and added RTools to my path:

Sys.getenv("PATH")
[1] "C:\rtools40\usr\bin;C:\Program Files\R\R-3.3.2\bin\x64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\IBM\SPSS\Statistics\25\JRE\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Mplus Demo\;C:\Users\Anni\AppData\Local\Microsoft\WindowsApps;"

It also didn't work after that, so I followed another instruction and did this (like described here: Rtools not found after R 4.0.0 installation) :
Sys.setenv(PATH = paste(Sys.getenv("PATH"),
"C:\RTools40",
"C:\RTools40\mingw64\bin",
sep = ";"))

Now my path looks like this:

Sys.getenv("PATH")
[1] "C:\rtools40\usr\bin;C:\Program Files\R\R-3.3.2\bin\x64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\IBM\SPSS\Statistics\25\JRE\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Mplus Demo\;C:\Users\Anni\AppData\Local\Microsoft\WindowsApps;;C:\RTools40;C:\RTools40\mingw64\bin"

Unfortunately, I still cannot install ggplot2. Now I receive the following errors:

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


Installing package into ‘C:/Users/Anni/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependencies ‘pkgbuild’, ‘rematch2’, ‘brio’, ‘callr’, ‘pkgload’, ‘processx’, ‘ps’, ‘waldo’, ‘testthat’, ‘farver’, ‘lifecycle’, ‘cli’, ‘ellipsis’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘vctrs’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’

There are binary versions available but the source versions are later:
binary source needs_compilation
rematch2 2.0.1 2.1.2 FALSE
callr 2.0.3 3.5.1 TRUE
processx 2.0.0.1 3.4.4 TRUE
testthat 2.0.0 3.0.0 TRUE
cli 1.0.0 2.2.0 FALSE
fansi 0.2.2 0.4.1 TRUE
magrittr 1.5 2.0.1 FALSE
pillar 1.2.1 1.4.7 FALSE
rlang 0.2.0 0.4.8 TRUE
scales 0.5.0 1.1.1 TRUE
tibble 1.4.2 3.0.4 TRUE
ggplot2 2.2.1 3.3.2 FALSE

Do you want to install from sources the packages which need compilation?
y/n: y
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘brio’
‘pkgload’ ‘ps’ ‘farver’ ‘ellipsis’ ‘vctrs’ ‘isoband’
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ‘pkgbuild’, ‘rematch2’, ‘brio’, ‘callr’, ‘pkgload’, ‘processx’, ‘ps’, ‘waldo’, ‘testthat’, ‘farver’, ‘lifecycle’, ‘cli’, ‘ellipsis’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘vctrs’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’, ‘ggplot2’

[...]

Warning in install.packages :
Ausführung von Kommando '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\Anni\Documents\R\win-library\3.3" C:\Users\Anni\AppData\Local\Temp\RtmpCGx0Ww/downloaded_packages/ggplot2_3.3.2.tar.gz' ergab Status 1
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status

Does anyone have an idea what else I can do? I am a bit desperate here...

What version or R are you running?

R.Version()

RTools40 is to be used with R >= 4.0.0 for older R versions (like the one you are using) you can download the corresponding RTools version from here

Oh boy...it was so simple.
I recently installed R 4.0.3 but still had R 3.3.2 on my pc.... it now works after deinstalling the older R version.
Thank you for your efforts!

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.