Turns out when I installed RTools I left out the R 2.15.x+ toolchain option in the installation, which lead to the gcc never being installed. Hopefully, this post will serve as a diagnostic guide if RStudio fails to register RTools.

Thank you everyone for your help.

Answer from coatless on Stack Overflow
🌐
GitHub
github.com › rstudio › rstudio › issues › 8221
Rtools not recognized even when it is installed · Issue #8221 · rstudio/rstudio
October 29, 2020 - WARNING: Rtools is required to build R packages but is not currently installed.
Author   rstudio
🌐
GitHub
github.com › rstudio › rstudio › issues › 3563
RStudio do not find Rtools and offer to install even if already installed · Issue #3563 · rstudio/rstudio
September 30, 2018 - I think I get the message because .Call("rs_canBuildCpp") returns FALSE. I think this function is not checking the PATH environment variable. If I uninstall Rtools, get the installer directly from CRAN, double click on it and install Rtools in C:/Rtools, configure PATH with new paths, oddly everything is working now.
Author   rstudio
🌐
Reddit
reddit.com › r/rlanguage › issues installing rtools package
r/Rlanguage on Reddit: Issues installing Rtools package
April 20, 2024 -

I have Rstudio 2023.12.1 build 402.

I initially tried installing the Rtools package & got the following error:

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

I went to the below site & downloaded the Rtools43 installer, and am still getting the same error when i try running install.packages("Rtools") or install.packages("Rtools43").

https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html

Does anyone know what I'm doing wrong?

🌐
Reddit
reddit.com › r/rstats › rtools isn't recognized by r
r/rstats on Reddit: Rtools isn't recognized by R
May 28, 2021 -

Hi. I updated R recently and everything turned in a mess. Somehow R (nor Rstudio) don't find Rtools but devtools keeps saying that Rtools is in effect installed.

I checked my Path variables several times with no luck. As far as I know, Sys.which("make") points to the correct location but Sys.which("gcc") fails. I tried using the instruction Sys.setevn to point BINPREF properly with no luck too.

Any tips or advice? I run out of ideas checking SE and Rstudio community

Edit: Currently working on a Win 10, with R 4.1.0

Edit 2: already reinstalled Rtools+R with no results. Also Path was updated to point to rtools40/usr/bin as Rtools (windows) help suggest

Edit 3: [SOLVED] Thanks everyone, but none of the solutions works. I decided to use a killer approach (clean installation of windows) and it worked.

🌐
R Project
cran.r-project.org › bin › windows › Rtools › rtools40.html
Using Rtools4 on Windows
By default, R for Windows installs the precompiled “binary packages” from CRAN, for which you do not need Rtools.
Top answer
1 of 5
34

I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

Basically you have to set two environment variables to point to the correct installation path of Rtools:

Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")

Ensure that for the BINPREF path, the final slash is included after bin.

To avoid losing this change after restarting RStudio you could modify your (Windows) environment variables instead or add the following rows to your .Renviron file that is executed at each startup of R.

BTW: The $(WIN) part is no typo but required so that R can inject "32" or "64" depending on the R version you are using (32 or 64 bit).

Edit 1: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

2 of 5
3

Note that there are new potential kinds of problems (from R 3.3 onwards), since R (not RStudio, but R) adds a BINPREF variable and modifies the Path variable by default, see the Renviron.site file for the latter, on Windows typically e.g. under C:\Program Files\R\R-3.4.3\etc:

PATH="C:\Rtools\bin;${PATH}" 

This might easily conflict for people with a custom path and/or multiple versions of Rtools installed, so I have commented this out with a #.

For the BINPREF problem, see the Makeconf file, e.g. under C:\Program Files\R\R-3.4.3\etc\x64:

BINPREF ?= c:/Rtools/mingw_64/bin/

I have then modified this to c:/Rtools34/mingw_64/bin/, which is where I have installed my Rtools34.
You can do the same for the Makeconf file under the 32-bit arch. sub-directory.

Find elsewhere
🌐
Reddit
reddit.com › r/rlanguage › help wanted: trouble installing and loading packages. rtools isn’t in my version of r?
r/Rlanguage on Reddit: Help wanted: Trouble installing and loading packages. Rtools isn’t in my version of R?
March 28, 2023 -

Let me start with: this is on my work computer and I work for a place where I am not allowed to download any software myself so I can’t try to update.

I have R version 4.2.1 (2022-06-23 ucrt).

So I was trying to download the tidy verse & ggplot2 and got the following error message:

library(ggplot2) Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):

there is no package called ‘colorspace’ In addition: Warning message: package ‘ggplot2’ was built under R version 4.2.3

——————-.

This led me to try to download colorspace, but that pulled this error:

install.packages('colorspace') 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/twaj/AppData/Local/R/win-library/4.2’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/colorspace_2.1-0.zip'

Content type 'application/zip' length 2628852 bytes (2.5 MB) downloaded 2.5 MB package ‘colorspace’ successfully unpacked and MD5 sums checked The downloaded binary packages are in [the folder].

———————-.

So I tried to download Rtools but i get the same error. I need Rtools to download Rtools.

Any suggestions????

🌐
Stack Overflow
stackoverflow.com › questions › 29912320 › r-rtools-not-working
windows - R- Rtools not working - Stack Overflow
Please download and install Rtools 3.1 from http://cran.r-project.org/bin/windows/Rtools/ and then run find_rtools(). Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry Error: loading failed Execution halted *** arch - x64 Warning: package 'qdapDictionaries' was built under R version 3.2.0 Warning: package 'qdapRegex' was built under R version 3.2.0 Warning: package 'qdapTools' was built under R version 3.1.3 Warning in fun(libname, pkgname) : bytecode version mismatch; using eval Warning: package 'RColorBrewer' was built under R version 3.1.3 WARNING: Rtools is required to build R packages, but is not currently installed.
Top answer
1 of 5
20

The message indicates RTools isn't installed properly. Download and install it like so:

  1. Go here
  2. Download rtools for your version of R
  3. Find the file that just downloaded
  4. Double click on it to start installation
  5. Close and reopen RStudio
  6. Everything should work now!

A nice 2-minute video explainer can be found here.


Why is RTools necessary in the first place?

Rtools adds are some tools to allow you to build packages. Not all packages need it; just the ones that use C, C++ or Fortran code.


If you have problems installing

  • If the instructions above don't result in a successful installation of Rtools, the following may help.
  • Re-install R. Try to stick to the default installation settings if possible. Don't forget to close all current R sessions before reinstalling, then start a new R session and see if it works as expected. If not, try downloading and installing Rtools as outlined at the top of this answer; hopefully it installs as expected now.
  • Make sure your anti-virus software isn't preventing it being installed. Anti virus software can sometimes mistake it for something harmful and quarantine it.
  • When reinstalling R, or when installing Rtools manually, be careful to look for any indication that you do not have write permissions to the drive you're installing to. If you don't have permission to install certain things, that may be what's causing Rtools to not install correctly. This is more likely to happen if there are multiple users on your Windows computer, or if your organisation has strict policies about what can be installed. To look into this, figure out where Rtools is being installed to, and ensure you have the ability to write to that folder.
2 of 5
3

If somoeone is still looking, be sure to check if you use the right version of Rtools. E.g. if you have R 4.3.3 install Rtools43 not Rtools44.

🌐
Posit Community
forum.posit.co › general
Rtools isn't being detected - General - Posit Community
October 28, 2022 - I'm trying to install some packages, and keep getting the following error: WARNING: Rtools 4.2 s required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding: ...
🌐
Stan Forums
discourse.mc-stan.org › interfaces › rstan
Warning that I need to install Rtools when I already have it installed - RStan - The Stan Forums
September 12, 2023 - Howdy! I am trying to install rstan on a computer with Windows 10 that is very troublesome due to lots of clamped down security. I have R 4.3.0 and Rtools 4.3 installed. I can only install binaries from a http CRAN repository on this machine. I seem to have successfully installed the new rstan 2.26 from CRAN, but when I ran the example model, I got the following warnings: WARNING: Rtools is required to build R packages, but no version of Rtools compatible with R 4.3.0 was found.
🌐
Stack Overflow
stackoverflow.com › questions › 30315435 › rtools-not-working-in-command-prompt
r - Rtools not working in command prompt - Stack Overflow
Try R --vanilla . Perhaps you're loading a workspace which is too large for your RAM. ... If anyone has this problem in the future. Josh W. comments, while a good idea, did not help.
🌐
GitHub
github.com › r-lib › devtools › issues › 1772
find_rtools() doesn't recognize Rtools 3.5 in R 3.5.0 · Issue #1772 · r-lib/devtools
April 23, 2018 - I installed Rtools 3.5 from here, but when I run find_rtools() in the latest release of R 3.5.0 I get this WARNING: Rtools is required to build R packages, but no version of Rtools compatible with R 3.5.0 was found. (Only the following i...
Author   r-lib
🌐
Reddit
reddit.com › r/rstudio › rtools not installing properly no matter what
r/RStudio on Reddit: RTools not installing properly no matter what
January 21, 2023 -

Hey all, I'm fairly new to RStudio, and I recently got a new laptop. I've tried installing RTools on it in a myriad of different ways; I've uninstalled and reinstalled everything, individually as well as all at once; I've edited the .renviron folder; I've ensured absolutely nothing is on OneDrive, and yet nothing works. I feel like I'm going insane. Does anyone have any sort of workaround? Any advice is appreciated.

Edit: Turns out Rtools 4.3 is not compatible with RStudio 4.2.2... very silly move on my part and thank you all for your help.