1

I recently updated to R version 4.0.5.

I have tools installed in C:/rtools40

However, each time I run install.packages("rJava")

I get the following:

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/Pragyaditya Das/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rJava_1.0-4.zip'
Content type 'application/zip' length 1127320 bytes (1.1 MB)
downloaded 1.1 MB

package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Pragyaditya Das\AppData\Local\Temp\RtmpuEjxI8\downloaded_package

I get a warning that Rtools is not installed.

To check if rtools is in path or not, I did Sys.getenv("PATH") and I can see that Rtools is in path.

In addition to that, I also installed devtools and did find_rtools(). From this I get TRUE.

I don't know what to do and what to look for.

Please help.

TIA.

Phil
  • 7,287
  • 3
  • 36
  • 66
Pragyaditya Das
  • 1,648
  • 6
  • 25
  • 44
  • And just to verify, but loading `rJava` doesn't work? – slamballais May 14 '21 at 06:59
  • @Laterow Yes, `rJava` doesn't work. Error is: ```> library(rJava) Error: package or namespace load failed for ‘rJava’: .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'C:/Users/Pragyaditya Das/Documents/R/win-library/4.0/rJava/libs/x64/rJava.dll': LoadLibrary failure: The specified module could not be found.``` – Pragyaditya Das May 14 '21 at 07:00
  • Did you try to use R GUI, not RStudio? – zx8754 May 14 '21 at 07:09
  • So are you sauing `C:/rtools40/usr/bin` is on the path? Or just a (possibly older) version of R tools. What does `Sys.which("make")` return? – MrFlick May 14 '21 at 07:14
  • Try running `pkgbuild::has_rtools(debug=TRUE)` and sharing the output – MrFlick May 14 '21 at 07:19
  • @MrFlick I get the following ```make ""``` on running ```Sys.which("make")``` – Pragyaditya Das May 14 '21 at 07:20
  • @zx8754 I do not have R GUI, however I ran on Rterm and got the same error. – Pragyaditya Das May 14 '21 at 07:21
  • If `Sys.which("make")` returns "" then you do not have your PATH variable set up correctly. Note when you change your PATH variable, you need to restart R. – MrFlick May 14 '21 at 07:22
  • @MrFlick when I run `pkgbuild::has_rtools(debug=TRUE)` I get the following error ```Scanning R CMD config CC... cc_path: '' does not exist Scanning path... Scanning registry... Found C:/rtools40 for 4.0 [1] TRUE ``` – Pragyaditya Das May 14 '21 at 07:22
  • @MrFlick When I run `Sys.getenv("PATH")`, I get the following ```[1] "C:\\Users\\Pragyaditya Das\\.cargo\\bin;C:\\Users\\Pragyaditya Das\\anaconda3;C:\\Users\\Pragyaditya Das\\anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Pragyaditya Das\\anaconda3\\Library\\usr\\bin;C:\\Users\\Pragyaditya Das\\anaconda3\\Library\\bin;C:\\Users\\Pragyaditya Das\\anaconda3\\Scripts;C:\\Users\\Pragyaditya Das\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Users\\Pragyaditya Das\\AppData\\Roaming\\npm;C:\\rtools40\\mingw64\\bin;"``` I can see that `rtools40` is there – Pragyaditya Das May 14 '21 at 07:42
  • @MrFlick I even restarted R. Same error. – Pragyaditya Das May 14 '21 at 07:42
  • 2
    You have `C:\\rtools40\\mingw64\\bin;`, but it should be `C:\\rtools40\\usr\\bin;` according to https://cran.r-project.org/bin/windows/Rtools/ – MrFlick May 14 '21 at 07:44
  • @MrFlick Done. Now my `Sys.getenv()` looks like this `"C:\\Program Files\\R\\R-4.0.5\\bin\\x64;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin;C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\libnvvp;C:\\Rtools\\bin; C:\\Users\\Pragyaditya Das\\AppData\\Roaming\\npm;C:\\rtools40\\mingw64\\bin;;C:\\RTools40;C:\\RTools40\\usr\\bin"` and `Sys.which("make")` returns `make "C:\\RTools40\\usr\\bin\\make.exe" ` – Pragyaditya Das May 14 '21 at 08:11
  • @MrFlick Its working now. Thank you. Please write it as an answer for the benefit of the community. – Pragyaditya Das May 14 '21 at 08:22
  • @MrFlick Each time I restart R, the PATH resets to `rtools40\migw64\bin`. How to make it permanent – Pragyaditya Das May 14 '21 at 11:56
  • Well when you installed rtools what exactly did you do? Did you use the control panel to set a system wide PATH environment variable? Did you create an .Rprofile file in your home directly as suggested by the link I shared? Somewhere you entered the wrong value but it’s not clear where. – MrFlick May 14 '21 at 16:03
  • @MrFlick I solved the problem. :) – Pragyaditya Das May 14 '21 at 16:44
  • Well, what was the problem? You can answer your own question below for the benefit of the community. – MrFlick May 14 '21 at 16:45
  • @MrFlick a broken rtools installation. I was too tired of all the hassle. So, I uninstalled Rtools and RStudio and now its working perfectly. Sounds a bit too much, but this is what I did. – Pragyaditya Das May 14 '21 at 16:48

0 Answers0