New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RStudio do not find Rtools and offer to install even if already installed #3563
Comments
|
@cderv Thank you for filing this issue. Is it still an issue with the most recent preview release? |
|
This is still an issue with preview version. callr::rcmd_safe("config", "CC")$stdout
#> [1] "c:/Rtools/mingw_64/bin/gcc\n"However, if I used the installer from When I use I remind that if I use the binary installer I download from CRAN directly,it offers an installation in Also, if I am outside of Rstudio where So, I don't know why
This is definitely an edge case because I am not sure everyone we'll look into it as I did and there is a quick workaround but this is definitely something strange in behaviour from RStudio. Also, in addition, Let me know how I can help if you want to dig more. |
|
I'm not able to reproduce on my machine. I have a single installation of Rtools located at
This is the default for R, but RStudio updates the PATH as needed whenever we're about to take an action that will invoke Rtools.
I don't think this is true -- we download Rtools using the user's current rstudio/src/cpp/session/modules/build/SessionInstallRtools.cpp Lines 81 to 90 in 275d6eb
RStudio runs the moral equivalent of It might be worth asking whether this works for you: It would also be worth checking what the output of rstudio/src/cpp/session/modules/ModuleTools.R Lines 85 to 88 in 275d6eb
(IIRC this is what devtools used to do at least; not sure if that also reflects the current state of affairs) |
|
Also worth saying that older versions of RStudio actually had an issue where these compilation attempts could fail if R itself was not on the PATH, but that should be fixed in the latest v1.2 builds. But it might be worth checking if ensuring R is also on the PATH makes a difference. |
|
Thanks. With Rbuildtools out of my PATH (like you)Here is the result of my PATH from R Sys.getenv("PATH")writeLines(strsplit(Sys.getenv("PATH"), ";")[[1]])
#> C:\Program Files\R\R-3.5.1\bin\x64
#> C:\Program Files (x86)\Intel\iCLS Client\
#> C:\ProgramData\Oracle\Java\javapath
#> C:\Program Files\Intel\iCLS Client\
#> C:\Windows\system32
#> C:\Windows
#> C:\Windows\System32\Wbem
#> C:\Windows\System32\WindowsPowerShell\v1.0\
#> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
#> C:\WINDOWS\system32
#> C:\WINDOWS
#> C:\WINDOWS\System32\Wbem
#> C:\WINDOWS\System32\WindowsPowerShell\v1.0\
#> C:\ProgramData\chocolatey\bin
#> C:\Program Files\nodejs\
#> C:\Program Files\SourceGear\Common\DiffMerge\
#> C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
#> C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
#> C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
#> C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
#> C:\WINDOWS\System32\OpenSSH\
#> C:\Program Files\Microsoft VS Code\bin
#> C:\Program Files (x86)\GitExtensions\
#> C:\Program Files\Git\cmd
#> C:\Users\chris\AppData\Roaming\TinyTeX\bin\win32I delete Rbuildtools from my PATH as you did. By not having Rtools on PATH, I have that nzchar(Sys.which("ls.exe")) && nzchar(Sys.which("gcc.exe"))
#> FALSEand file <- tempfile(fileext = ".c")
writeLines("void test() {}", con = file)
R <- file.path(R.home("bin"), "R")
system2(R, c("CMD", "SHLIB", shQuote(file)))
#> Warning message:
#> In system(cmd) : 'make' not foundWith that setup,
pkgbuild::has_rtools(TRUE)
#> Scanning R CMD config CC...
#> cc_path:
#> '.exe' does not exist
#> Scanning path...
#> Scanning registry...
#> Found C:/RBuildTools/3.5 for 3.5
#> VERSION.txt
#> Rtools version 3.5.0.4
#> [1] TRUE(I am using last dev version 9ad3c7176 of remote.) So issue is different, but there is still something off. With Rbuildtools on PATHHere is the result of my PATH from R Sys.getenv("PATH")writeLines(strsplit(Sys.getenv("PATH"), ";")[[1]])
#> C:\Program Files\R\R-3.5.1\bin\x64
#> C:\Program Files (x86)\Intel\iCLS Client\
#> C:\ProgramData\Oracle\Java\javapath
#> C:\Program Files\Intel\iCLS Client\
#> C:\Windows\system32
#> C:\Windows
#> C:\Windows\System32\Wbem
#> C:\Windows\System32\WindowsPowerShell\v1.0\
#> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
#> C:\WINDOWS\system32
#> C:\WINDOWS
#> C:\WINDOWS\System32\Wbem
#> C:\WINDOWS\System32\WindowsPowerShell\v1.0\
#> C:\ProgramData\chocolatey\bin
#> C:\Program Files\nodejs\
#> C:\Program Files\SourceGear\Common\DiffMerge\
#> C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
#> C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
#> C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
#> C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
#> C:\WINDOWS\System32\OpenSSH\
#> C:\Program Files\Microsoft VS Code\bin
#> C:\Program Files (x86)\GitExtensions\
#> C:\Program Files\Git\cmd
#> C:\Users\chris\AppData\Roaming\TinyTeX\bin\win32
#> C:\RBuildTools\3.5\bin
#> C:\RBuildTools\3.5\mingw_64\binThis time nzchar(Sys.which("ls.exe")) && nzchar(Sys.which("gcc.exe"))
#> TRUEand this is now an error file <- tempfile(fileext = ".c")
writeLines("void test() {}", con = file)
R <- file.path(R.home("bin"), "R")
system2(R, c("CMD", "SHLIB", shQuote(file)))
#> c:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-3.5.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c C:\Users\chris\AppData\Local\Temp\RtmpEzOPTn\file20744004747f.c -o C:\Users\chris\AppData\Local\Temp\RtmpEzOPTn\file20744004747f.o
#> sh: c:/Rtools/mingw_64/bin/gcc: No such file or directory
#> make: *** [C:/PROGRA~1/R/R-3.5.1/etc/x64/Makeconf:208: C:\Users\chris\AppData\Local\Temp\RtmpEzOPTn\file20744004747f.o] Error 127With this setup > install.packages("glue", type = "source")
Installing package into 'C:/Users/chris/Documents/R/win-library/3.5'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/glue_1.3.0.tar.gz'
Content type 'application/x-gzip' length 56368 bytes (55 KB)
downloaded 55 KB
Using libraries at paths:
- C:/Users/chris/Documents/R/win-library/3.5
- C:/Program Files/R/R-3.5.1/library
* installing *source* package 'glue' ...
** package 'glue' correctement décompressé et sommes MD5 vérifiées
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-3.5.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c glue.c -o glue.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-3.5.1/etc/i386/Makeconf:208: glue.o] Error 127
ERROR: compilation failed for package 'glue'
* removing 'C:/Users/chris/Documents/R/win-library/3.5/glue'
* restoring previous 'C:/Users/chris/Documents/R/win-library/3.5/glue'
In R CMD INSTALL
Warning in install.packages :
installation of package 'glue' had non-zero exit status
and pkgbuild::has_rtools(TRUE)
#> Scanning R CMD config CC...
#> cc_path: C:/RBuildTools/3.5/mingw_64/bin/gcc
#> install_path: C:/RBuildTools/3.5
#> VERSION.txt
#> Rtools version 3.5.0.4
#> Found compatible gcc from R CMD config CC
#> [1] TRUEDoes this help ? Is it only on my computer ? Nota: About Rtools download
This is what strike me... there is a different behavior I don't explain yet. Rtools installer must have a non-interactive install mode. |
|
Deleted a prior incorrect analysis. It all comes down to the and evidently RStudio does this for you behind the scenes through some APIs, but this step is skipped if it already sees some Rtools utilities on the PATH. tl;dr: If you want to explicitly set up Rtools, you need to update both the PATH and BINPREF environment variables. |
|
Ok so this all relies on I found CRAN doc page about this
So either
Thanks for all this clarification. It was really interesting to dig into that. I understand that RStudio hides all that and tries to do all this by itself. RStudio Do you think maybe something can/should be made to help users ? (but I may be the only one disturbed by that... Either in |
|
I think there's a couple options (not mutually exclusive):
|
|
I think we now properly handle this particular case on the RStudio side: if we detect that Rtools is on the PATH but Ironically, you would make your life easier by not trying to put Rtools on the PATH for RStudio here :-) |
The easier is to install Rtools with admin right, from CRAN website, manually. Using the one I get with How can I test ? With rstudio daily build from today ? And thanks a lot for your help and investigation ! |
|
The latest daily build should indeed have the change. Note that this will only currently fix build actions performed by RStudio; e.g. 'Install and Restart' with Ctrl + Shift + B. Other packages (e.g. |
|
Ok I see. I'll test soon with the IDE and I will also see if I can come up with some ideas for other Thanks a lot! |
|
@cderv We think this is fixed, so we're closing the issue -- please feel free to reopen if it still looks busted on your end! |
|
I am still seeing this error on 1.2.1280. Has this fix made it to Preview yet? |
|
Yes, it should have been fixed. Can you elaborate on exactly what you're seeing? (the issue has gotten a bit long and difficult to track) |
|
I have installed Rtools 3.5 direct from the Rtools website and Rstudio does not detect it. I see: |
Sorry to be pedantic, but what does this mean? Do you mean that attempts to build packages (e.g. Ctrl + Shift + B) fail? Or that attempts to install packages from source fail? Or something else? |
|
Same as in the issue title: Rstudio offers to install Rtools when attempting to install a package from source via |
|
Can you also share your session info? Are you using If Ctrl + Shift + B works for R package projects, but |
|
Also note that RStudio would normally set rstudio/src/cpp/core/r_util/RToolsInfo.cpp Lines 163 to 166 in 9af8c61
and it seems to work for me: |
> devtools::session_info()
- Session info -----------------------------------------------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz Pacific/Auckland
date 2019-02-23
- Packages ---------------------------------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.1)
backports 1.1.2 2017-12-13 [1] CRAN (R 3.5.0)
callr 2.0.4 2018-05-15 [1] CRAN (R 3.5.1)
cli 1.0.0 2017-11-05 [1] CRAN (R 3.5.1)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.1)
curl 3.2 2018-03-28 [1] CRAN (R 3.5.1)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.2)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.1)
fs 1.2.3 2018-06-08 [1] CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.1)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.1)
packrat 0.4.9-3 2018-06-01 [1] CRAN (R 3.5.1)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.2)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.2)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.2)
processx 3.2.0.9000 2018-11-14 [1] Github (r-lib/processx@8374340)
ps 1.2.1 2018-11-06 [1] CRAN (R 3.5.1)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.1)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.2)
rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.1)
rstudioapi 0.7 2017-09-07 [1] CRAN (R 3.5.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.2)
stringi 1.1.7 2018-03-12 [1] CRAN (R 3.5.0)
stringr 1.3.1 2018-05-10 [1] CRAN (R 3.5.1)
testthat 2.0.0 2017-12-13 [1] CRAN (R 3.5.1)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.2)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)
[1] C:/Users/kmbel/Documents/R/win-library/3.5
[2] C:/Program Files/R/R-3.5.1/libraryCtrl + Shift + B can see Rtools but still offers to install Rtools after it fails: When you say it works for you, have you installed Rtools yourself before running rstudio? |
|
I am even still getting the same behavior after uninstall all of rtools, R, and RStudio, installing R and RStudio fresh, and letting RStudio install its own Rtools. |
|
@kendonB Any luck with this issue? I am getting the same behavior too. I'm running on a Windows 10 machine. |
|
Still no luck. I have no idea how to fix it. I don't usually use that computer so I haven't tried too hard to fix it |
|
I see. This is really frustrating. I feel like I'm close to finding out what's the problem but I'm not sure how to do it. It seems that setting the path for Rtools is only temporary (disappears after I restart R), and I'm trying to find out how to set the path to Rtools permanently. I'm curious if the computer you're trying to install Rtools on is a institution's machine? As in you don't have full administrative rights to the computer. |
I don't know why R is attempting to run a program called @blueswimmer does it make a difference if you update the PATH in e.g. A reproducible example would be helpful if at all possible. |
|
I hope this is the right place to add: I have a similar problem. This thread already helped a lot to narrow it down, but i havent solved it yet. System: RStudio Edition : Desktop Steps to reproduce the problem: On a windows machine with R 3.5.1, install Rtools in C:/Program Files/R/Rtools. Describe the problem in detail: I add BINPREF, BINPREF64 (and PATH, see section Additional Info), but only nzchar(Sys.which("ls.exe")) is TRUE after setting the variables, nzchar(Sys.which("gcc.exe")) is FALSE, see the code below. Desired behaviour: I want to install packages from source: But installing from source fails Additional info: Setting variable for Rtools was also done: R tools can be found: I have R installed within the company network, so i cant install / uninstall new versions that easily. Check that @cderv mentioned: and and @kedonb check: Other tools installed within Rtools folder. I checked whether i have other stuff installed / moved in there. Thats not the case. |
|
The BINPREF variables need to be set using forward slashes ( This line: makes it clear that the compiler could not be found, because your BINPREF is malformed. FWIW I believe it is sufficient to set and ignore BINPREF64 (but I could be wrong) |
|
Thank you so much for the fast reply! You are right, i should have taken a closer look at that line. Using forward slashes helped. In addition i had to clean up the Steps to fix my problem were: Edit: |
This is what I have set and I can confirm it works for me. |
|
|
I have tried setting BINPREF but I still get the same problem. The only thing that works seems to be setting options(buildtools.check = NULL) . I have RStudio Version 1.2.1335 , and the BINPREF set with only difference that I point to RBuildTools (because it was installed by RStudio) rather than Rtools. Will this be fixed? It's a bit annoying. |
|
ELI5 why function rstudio/src/cpp/session/modules/build/SessionBuildEnvironment.cpp Lines 137 to 145 in cf5076a
Also here, R/sh/make/whatever has problems with paths with spaces rstudio/src/cpp/core/r_util/RToolsInfo.cpp Line 165 in cf5076a
|
|
Same Issue happens again with BINREF env var & path doesn't fix it |
|
I have followed the direction on my personal computer and everything works fine. On the other hand, I installed Rtools on my work computer and everything did not work. After spending some time, I found an antivirus program called cylance is blocking the shell program (i.e., sh.exe) from executing my program. I have requested to whitelist any exe files in RTools. #Add this line to .Rprofile |
|
yep, seems that is the problem. |
|
Setting [rant] You should probably either accomodate (i.e. in an easier way) for custom installation locations of Rtools or force the installation path of Rtools (which would be bad IMHO: I got stuck here for the sole reason that I don't have write access to C:/ and since everything else doesn't require the user to have administrative rights...). All in all, you must also acknowledge that expecting the user to find this thread and update an environment variable is far from a fix worth closing this issue. Don't take this the wrong way: I'm overall amazed by the capabilities of RStudio and really thankful for the hard work! |
|
The issue here, as I understand it... If Rtools is not on the PATH, then RStudio will attempt to find Rtools and set it up appropriately. This includes setting rstudio/src/cpp/core/r_util/RToolsInfo.cpp Lines 163 to 166 in e4a1c21
If Rtools is on the PATH, then RStudio assumes that it has already been set up appropriately, and doesn't take any further action (ignoring I don't know if this requirement (setting |
|
Hi, I also don't know if I'm incorporating the code in the well-formatted manner as I see it in the other posts. However this is what I can report: `pkgbuild::find_rtools(debug = TRUE) Sys.which('gcc.exe') I also tried to update R, RStudio and tried the old Rtools version (3..) and also Rtools 4.0.0. I tried setting PATH and BINPREF but I still encounter the problem. Best, |
|
What is the result of Note that the check: |
|
Thanks for your answer. I made it work by copying the gcc file in the usr folder because when I changed the |
|
After I install Rtools4 i see folder names as mingw32, mingw64, not mingw_32, mingw_64 where shell try to find it. |
|
There is a new set of instructions for RTools40 on Windows (released April 2020) |
|
When I run The result is I've tried the instructions on the URL https://cran.r-project.org/bin/windows/Rtools/ But I still get the same error |
|
Got this error yesterday, fixed it by installing vctrs from source
with--no-multiarch option and BINPREF set to the bitness of my R install.
Le ven. 4 sept. 2020 à 4:55 AM, sheilaabad <notifications@github.com> a
écrit :
… When I run
library(caret)
The result is
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j
<- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘vctrs’
Error: package ‘ggplot2’ could not be loaded
I've tried the instructions on the URL
https://cran.r-project.org/bin/windows/Rtools/
But I still get the same error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3563 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFTXN7XZLPORY5GYDJX4PDDSEBJJNANCNFSM4FYEIADQ>
.
|
|
Hello, guys. I ran into similar problem today and finally figured out the solution. The solution worked for me is from user RolandASc on this thread: https://stackoverflow.com/questions/33103203/rtools-is-not-being-detected-from-rstudio I manully modified the Makeconf file in my installed R path. e.g. .../R-3.5.1/etc/x64. I changed from BINPREF ?= c:/Rtools/mingw_64/bin/ to: BINPREF ?= C:/rtools40/mingw64/bin/ which is the place where I have installed my Rtools. In this way, RStudio recognizes rtools automatically. |
|
The problem with that solution is that R 3.5.1 wasn't built with the rtools40 toolchain. Older versions of Rtools are available at https://cran.r-project.org/bin/windows/Rtools/history.html; you'd want to use Rtools35.exe: |
|
I see. Thanks for your kind reply! |
System details
Steps to reproduce the problem
On a windows machine with R 3.5.1,
install Rtools in
C:/Rbuildtools.This is the path by default where the installer install Rtools. The installer is the one that you get when your are inside Rstudio and
pkgbuild::has_build_tools()does not find Rtools.If you get the one on CRAN, it opens a box where you can choose where to install Rtools (by default C:/Rtools) - I do not know why the two installers are different.
Add to the PATH on the system
C:\RBuildTools\3.5\bin&C:\RBuildTools\3.5\mingw_64\bin.After that in RStudio, when trying to install from source with
devtools, RStudio IDE do not find Rtools and open a box to offer to download Rtools, even if I already have it.Describe the problem in detail
When trying to use any
devtoolsfunction (i.eload_all) that need Rtools, I get the message to download unless I use firstAfter that, everything works find with
devtools.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..Call("rs_canBuildCpp")returnsTRUEpkgbuild::has_build_tools()toopkgbuild::find_rtoolsseems to correctly get the information fromR CMD config CC this timeSo there seem to be something with the location where RTools is installed...🤔
Describe the behavior you expected
As I have everything set up in my PATH, I expected to get it to work directly in RStudio without having to call
pkgbuild::find_rtoolsSession info
The text was updated successfully, but these errors were encountered: