14

I'm trying to get R to recognize that I have installed Rtools.exe. I've tried installing it in several different locations. However, whenever I restart R and load devtools I get the same error:

> library(devtools)   
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 3.0 from http://cran.r-project.org/bin/windows
/Rtools/ and then run find_rtools().

Naturally, whenever I try the function find_rtools() I get the same error message. I'm done trying to figure this out with help files, as the devtools help doesn't offer much. I've tried installing in several of the locations returned by get_path() but the problem persists.

FYI, currently my R is installed at D:/R.

Has anyone else had this problem, and more importantly, can anyone help me? I'm sorry if this is a duplicate, and I've tried to include as many relevant details as possible so if you need any clarification please let me know.

Thanks, Nick

nickfishbane
  • 141
  • 1
  • 7
  • What version of devtools do you have? It doesn't offer much help because it should just work. – hadley May 18 '13 at 13:28
  • I am currently using devtools version 1.2. – nickfishbane Jun 18 '13 at 23:17
  • Can you please run `find_rtools(T)` and include the output? – hadley Jun 19 '13 at 12:05
  • `> find_rtools(T) Scanning path... Scanning registry... WARNING: Rtools is required to build R packages, but is not currently installed. Please download and install Rtools 3.0 from http://cran.r-project.org/bin/windows/Rtools/ and then run find_rtools().` – nickfishbane Jun 19 '13 at 17:11
  • How are you installing Rtools? Are you choosing any custom options on install? – hadley Jun 20 '13 at 12:56
  • No custom options, but unfortunately I work at a place with a secure (and frankly backwards) IT system in which I am not able, as a user, to change the C: drive or install programs on to it. I am also not allowed to edit the system PATH. But I installed it to D:/Rtools and added this to the user path, and that location does show up when I call `get_path()`. – nickfishbane Jun 26 '13 at 17:03
  • Did you add both `D:/Rtools` and `D:/Rtools/gcc-4.6.3/bin` to your path? – hadley Jun 27 '13 at 05:54
  • I added both of those as well as `D:/Rtools/gcc-4.6.3/bin32` for good measure, but unfortunately I get the same problem. Do you think it has something to do with system path vs. user path? – nickfishbane Jun 27 '13 at 17:34
  • What do `Sys.which("gcc")` and `Sys.which("ls")` return? – hadley Jun 28 '13 at 20:01
  • The first returns `gcc "D:\\Rtools\\GCC-46~1.3\\bin\\gcc.exe"` – nickfishbane Jun 28 '13 at 22:38
  • The second returns `ls ""` – nickfishbane Jun 28 '13 at 22:39
  • So you don't have the path set up correctly - you need to figure out where ls.exe is on your computer and make sure that's in your path. – hadley Jun 29 '13 at 05:15
  • OK I seem to have several instances of ls.exe in different folders: cygwin, MinGW, Rtools itself, e.g. I've tried adding these to the path and retrying `Sys.which('ls')`, but I keep getting a blank. I made sure to add each individually and removing the one before it, and I always restart R. Would you know which is the correct version of ls.exe to add to the path? – nickfishbane Jul 02 '13 at 19:43
  • And thank you so much for your extensive help, tailored to a noob like me. – nickfishbane Jul 02 '13 at 19:44
  • You want the ls.exe in `Rtools/bin`. And you're welcome – hadley Jul 02 '13 at 21:42
  • Thanks, that seems to sort of work in that it's bringing me new problems. Now it seems as though both Rtools 3.0 and Rtools 3.1 are incompatible with R 3.0.1. Have you run into this? The exact error message when loading `devtools` is `WARNING: Rtools 3.1 found on the path at D:/Rtools is not compatible with R 3.0.1. Please download and install the appropriate version of Rtools from http://cran.r-project.org/bin/windows/Rtools/, remove the incompatible version from your PATH, then run find_rtools().` – nickfishbane Jul 03 '13 at 00:37
  • Same message for Rtools 3.0 – nickfishbane Jul 03 '13 at 00:42
  • 1
    Yes, that's fixed in the version of devtools I just pushed to cran. Will probably be a couple of days before it's available. – hadley Jul 03 '13 at 16:03
  • 3
    I got devtools 1.3 and Rtools was found! Thanks so much! – nickfishbane Jul 08 '13 at 17:34

5 Answers5

2

Grab the batch file Rpathset.bat from batchfiles, edit the SET statements in it appropriately and then run R like this from the Windows console:

Rpathset
Rgui
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341
  • Thanks for your solution, but I should mention that I don't have permission to edit the path on the computer, nor can I install software on the C:\ drive, where the WINDOWS registry is. This also means I can't install anything to the windows path. I realize this makes things difficult. But supposedly if Rtools is installed on the R path, it should work, right? The R path is on the D:/ drive. Could you please provide some further advice within these restrictions? – nickfishbane May 17 '13 at 20:41
  • Note that its not true that you can't change the path in a local process. You don't need any permissions for that. The solution posted works without any special permissions. No change to the registry is involved. All you do is edit the .bat file and run it followed by running Rgui in the same console session. – G. Grothendieck May 17 '13 at 20:43
2

I ran into this issue running a Windows 7 machine without admin rights. I leveraged G. Grothendieck's response, with a few additional steps.

  1. Get Rpathset.bat from https://code.google.com/p/batchfiles/
  2. Edit the Set statements in Rpathset.bat to your paths
  3. Run CMD and change directories to where Rpathset.bat is stored
  4. In the command prompt, run rpathset.bat > mypath.txt
  5. Open mypath.txt with a text editor
  6. Click Windows Start and search for environment
  7. Click Edit environment variables for your account
  8. Click path and then edit
  9. Copy and paste the entire path from mypath.txt into the Windows path (everything after the path statement)
  10. Restart RStudio and check that devtools::find_rtools() is TRUE
Whitebeard
  • 5,945
  • 5
  • 24
  • 31
  • actually you just need step 6 - 8. i.e. add `C:\RTools;C:\RTools\gcc-4.6.3\bin` to `PATH` by clicking `Edit...` (creating a `New...` if `PATH` does not exists") – chinsoon12 Apr 29 '16 at 07:01
0

This file rtools.r contains the code for find_rtools(). It looks like it is trying to find ls and gcc in your system path (and then does some more checks based on the version) and if that fails it tries to look up SOFTWARE\R-core\Rtools in the the Windows registry.

Alex Vorobiev
  • 4,349
  • 21
  • 29
0

As Thomas mentioned here, "Rtools is not a package." This is what I did to install Rtools. My RStudio is running R version 3.1.3. So I downloaded Rtools31.exe from https://cran.r-project.org/bin/windows/Rtools/. I executed the exe file, selected all the default options in the Setup Wizard and installed. (I had admin privilege on the computer I was using but I am not sure if that makes any difference.) To check that it was properly installed, you can enter find_rtools() in the R prompt which should return TRUE if Rtools installed properly.

For R 3.0, you probably just need to download Rtools30.exe and follow the same steps above.

Community
  • 1
  • 1
sedeh
  • 7,083
  • 6
  • 48
  • 65
0

I ran into this problem trying to install Rtools33 to use Hadley Wickham's lineprof package. I got that error multiple times. I'm running Windows 7 on a laptop.

I was able to fix the problem by running the Rtools installation file as the windows Admin (i.e. right-click the Rtools33.exe and choose "Run as administrator")

I also made sure to point the path to the R source directory, which I kept in C:\Rtools\ (which contains C:\Rtools\bin\ and C:\Rtools\gcc-4.6.3\).

This solved the problem for me and I am now able to install lineprof from GitHub and make use of it.

BarkleyBG
  • 664
  • 5
  • 16