Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rtools is required to build R packages but is not currently installed

Tags:

r

rtools

I am relatively new to R/RStudio. I was successfully able to install packages until today. Each time I try to install a package, I receive the following error:

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/my. Name/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/openintro_1.7.1.zip' Content type 'application/zip' length 3136068 bytes (3.0 MB) downloaded 3.0 MB

Rtools is already installed on my machine, so I'm not sure why it's not being recognized.

I have tried un-installing and re-installing rtools but can't seem to resolve the issue. Any insight here would be greatly appreciated!

like image 404
slp Avatar asked Nov 24 '19 22:11

slp


People also ask

Is Rtools required to install packages?

As I said, Rtools is not an R package so it doesn't need to (or should) be in your package library, just install it in the default location (i. e. the "Program Files" folder) like you would do with any other software.

How do I install Rtools in RStudio?

Installing RToolsGo to https://cran.r-project.org/, click on 'Download R for Windows', then 'Rtools', and select the very latest version of RTools to download. After downloading has completed run the installer. Select the default options everywhere.

How do I know if Rtools is installed in RStudio?

has_rtools() determines if Rtools is installed, caching the results. Afterward, run rtools_path() to find out where it's installed.


1 Answers

If you haven't done so already, download and install Rtools

This will solve the problem 90% of the time:

  1. Go to this site
  2. Download rtools
  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!

Background info

The reason this is necessary is because:

Rtools is a collection of software you need to be able to call R from the command line on Windows. You need to be able to call R from the command line to build and install packages from source code. Most packages will also require the program pdflatex.


If you already downloaded and installed Rtools, but still have problems

If you already followed the instructions above, but it still says not found, it may help to:

  • 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.

Other possible causes of problems:

  • 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.
like image 110
stevec Avatar answered Nov 15 '22 17:11

stevec