How To Fix it – Rtools is required to build R packages but is not currently installed

By opening Rstudio on Windows and launching the installation of any package, you may get this WARNING message: Rtools is required to compile R packages but is not currently installed. Let’s see in this short article how to fix things so that this message no longer appears.

How to eliminate the message Rtools is required to build R packages…

Well, if you are on this page it means that by opening a suite on R, such as RStudio for example, and you tried to launch the command install.packages you got the following message:

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

How to Fix it Rtools warning message

First, you will need to check if you already have the Rtools application installed. It is separate software from R and requires independent installation. If this is not the case, proceed with the installation. Go to the official R Tools download page and download the latest release.

How to Fix it Rtools warning message download page

Download the 64bit or 32bit version depending on your system and the version of RStudio installed. Once downloaded, you should have a file on your system with a name similar to rtools40-x86_64.exe. Run it to launch the installation. Leave all the settings at default and in the end you should find the Rtools folder directly under C: . You can also decide to install it on another PATH but then remember to change this value during the following steps.

C:\rtools40

At this point, the next step will be to add this path to the environment variables. Let’s open the system environment variables. Go to the search field of the START menu and write “variables“. This should be enough to display the “Modify system-related environment variables” entry. Click on the item as shown in the figure.

How to Fix it Rtools warning message variabili ambiente

Immediately a window with several panels and buttons will appear. Click on the “Environment Variables” button at the bottom right.

How to Fix it Rtools warning message variabili ambiente 2

At this point the window with all the environment variables will be displayed. Select PATH and then press the Edit button.

How to Fix it Rtools warning message variabili ambiente 3

A third window will appear relating to all the paths inserted in the PATH environment variable. To add a new one, press the “New” button and then enter the path C:\rtools40\urr\bin (i.e. the one relating to your system (version and path)).

How to Fix it Rtools warning message variabili ambiente 4

At this point, we have completed everything. Press the OK button. Now you can relaunch your R suite, such as Rstudio, and try running the install.packages command again. If everything went correctly, the warning message will have disappeared.

Leave a Reply