Rtools 3.5 not recognized? - r

I just installed R3.5 (and RStudio) on a new computer that has not previously had R on it. I then installed the devtools package, and when I went to install a package off of github, I realized (when prompted!) I had forgotten to install Rtools, so I followed the prompts to do so. Interestingly, this R tools installed to the directory of C:\RBuildTools by default and with no prompts for setting path variables as I had recalled in previous versions.
When I reloaded R, I was prompted to install Rtools again. My path contained no reference to Rtools (or the Rbuildtools directory), and remembering that my past installations had used the dir C:\Rtools, I decided to uninstall C:\RBuildTools and installed a fresh version off http://cran.r-project.org/bin/windows/Rtools/ ( installed version 3.5) into C:\Rtools. In installation I had the path variable option checked.
I reloaded RStudio and checked to make sure Rtools was found:
> devtools::find_rtools()
Error in system(full, intern = TRUE, ignore.stderr = quiet, ...) : running command '"C:/PROGRA~1/R/R-35~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD config CC' had status 2
However, rtools appears in my PATH:
> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-3.5.0\\bin\\x64;C:\\Rtools\\bin;..."
So this doesn't appear to be an issue with Rtools not being added properly to my Path variable. Google searches have turned up seemingly related errors but nothing so far that solves my issue. I have tried both suggestions here and neither have worked. I wonder if this could be related to RStudio.

I had a similar problem with RTools 3.5.
The installer did add C:\RTools\bin to the PATH, but it did not add
C:\RTools\mingw_64\bin which apparently did cause some confusion.
After adding C:\RTools\mingw_64\bin to the PATH, everything was fine.
My symptoms were a bit different though: RStudio reported an error when trying to "Install and Restart" my package that RTools were not found, while devtools::find_rtools() reported them to be present.

I have a comprehensive answer here for rtools not being recognized thru use of pkgbuild
`devtools::install_github(repo)` keeps installing rtools35.exe
The code snippet acknowledges the github comment this is posted (helped by r-sig-finance citizens)
However, (I can't comment) the error of find_tools() has disappeared but remains in devtools::install_bitbucket() for the new code that was the ultimate target and is in a src/master on BB cloud.
I unloaded the devtools and installed with remotes
unloadNamespace("devtools")
library(remotes)
install_bitbucket(author/repo)
As I said the problem with find_tools is taken care of by pkgbuild loading all items

Try updating RStudio to the latest version.
I had this problem after updating Rtools to 3.5 and found that updating RStudio to 1.1.447 fixed it.
If that doesn't work, Can you run rstudioapi::versionInfo()$version from inside RStudio and share the output?
If this isn't your problem I found that RStudio keeps a log - and it helped me isolate this issue. In my case the file was located in, "C:\Users\my_windows_username\AppData\Local\RStudio-Desktop\log\rsession-my_windows_username.log"
I found this warning in the log time that corresponed to the error in RStudio
WARNING Unknown Rtools version: 3.5; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::scanRegistryForRTools(HKEY, bool, std::vector*) C:\Users\Administrator\rstudio\src\cpp\core\r_util\RToolsInfo.cpp:269
This indicated that RStudio didn't recognize 3.5, which led me to check for an updated version of RStudio.

Related

Rtools already installed, but package prompts to new install then quits because Rtooll is already installed

I tried to make the title as descriptive as possible. I`m trying to install the package Giotto on Rstudio, with
library(devtools)
library(remotes)
remotes::install_github("RubD/Giotto")
Then I get a prompt saying
Building R package from source requires installation of additional build tools
When clicking "yes" it starts downloading Rtools35. After the download is finished, another prompt gives
Another version of Rtools is already installed in: C:\RBuildTools\3.5. It is recommended to uninstall the old version before installing the new version.
Do you want to proceed anyway?
Both "Yes" and "No" fail to install. I also checked
> pkgbuild::rtools_path()
[1] "C:/RBuildTools/3.5/bin"
I tried uninstalling Rtools, but I don't have the privilege. Is this the only solution?
Thanks!

Rtools 4.0 not found during package installation

For many R packages I try to install (on my Windows 10 machine), I get a warning:
> install.packages('rstan')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
I thought this was just an erroneous error message since the installation seemed to proceed anyway, but recently I tried to install a package (rstan) and found it completely nonfunctional. My hunch is that since rstan relies completely on compiling code with rcpp, maybe I only got away with the previous packages because I wasn't using the functions in them that relied on Rtools.
I reinstalled Rtools 4.0, and devtools::find_rtools() returns TRUE. But when I run Sys.getenv()['PATH'] there is no Rtools on the path. There isn't a place in the installation process to tell it I want Rtools on the path either, so these instructions don't help - the menus they refer to don't exist for me. So I thought this might be an issue where the new Rtools 4.0 doesn't put itself on the system path. But the problem persisted even after I directly edited the Windows path environment variables (both system and user versions) to include the path given to me by pkgbuild::rtools_path() (C:\rtools40\usr\bin, a path which both exists and appears to be correct).
This doesn't seem to be the same problem as Rtools 4.0 (Rstudio falsely claims it was deleted), since there are no claims Rtools was deleted. It's also not the same as Rtools not being detected by R as far as I can tell: I'm not leaving any features out of my Rtools installation - I'm not even getting the option to in my install wizard.
Would appreciate any advice or recommendations.
Rtools40 requires that you add its bin directory to your PATH variable. The full instructions are here.
You can update your ~/.Renviron file with any of the following methods:
You can do that manually by opening ~/.Renviron and putting the following in it:
PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
You can also use R (Gui or RStudio or Shell) with the following:
writeLines(
'PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"',
con = file("~/.Renviron", open = "a")
)
Both of these methods require a restart of R.

Rtools not found by R when installing packages from CRAN

When install any new package I get errors saying Rtools is not found. I followed the manual install instructions for Rtools but still get the same error message.
> install.packages("phyloseq")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding
It seems R is not finding Rtools. Is there anyway to fix this?
I have noticed a second issue of previously installed packages disappearing also when starting new R sessions. Could these two issues be linked?
My R version in 4.0 and I am working in Windows 64bit
After installation is complete, you need to perform one more step to be able to compile R packages: you need to put the location of the Rtools make utilities (bash, make, etc) on the PATH. The easiest way to do so is create a text file .Renviron in your Documents folder which contains the following line:
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
Now restart R, and verify that make can be found, which should show the path to your Rtools installation.
Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"
https://cran.r-project.org/bin/windows/Rtools/
The second part with packages not being found has to do with upgrading the R version e.g. 3.5 to 3.6 or 3.6 to 4.0. If you go to Documents\R\win-library there will be a version folder with the libraries installed inside. Here is a script that will install the old libraries.
lib_loc <- "C:/Users/apdev/Documents/R/win-library/3.3"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
to_install
install.packages(pkgs = to_install)
https://community.rstudio.com/t/reinstalling-packages-on-new-version-of-r/7670/4

Can not install processr and procesR on Windows

Following this question, I am trying to install the package (running R64 as admin on Windows):
devtools::install_github("markhwhiteii/processr")
or
devtools::install_github("cardiomoon/processR")
However, I get the error message:
Error: Failed to install 'processr' from GitHub:
(converted from warning) cannot remove prior installation of package 'digest'
no matter which update option I select. Running the command .libPaths() I found the packages installation folder C:/Program Files/R/R-3.6.2/library and manually deleted the digest package and reinstalled it with package.install("digest"). But I still get the same error! I would appreciate it if you could help me understand what is the problem and how I can resolve it.
The simplest solution is to say no when install_github asks if it should replace digest.
If it still fails for some reason (and I can't see why; neither package requires a specific version of digest and you've reinstalled it in any case), then the problem is that devtools itself uses digest, so it can't be removed as long as devtools is loaded. So you can't use install_github.
You have a couple of options:
Clone the repo, then from the command line, run R CMD INSTALL . in that directory. Note that you'll need to insert the path to your R executable.
Install from the GitHub archive of the master branch: install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
The steps to install the markhwhiteii/processr package:
install.packages("devtools")
library(devtools)
install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
for testing the instalation:
library(processr)
processr::model1
Sent a PR on the GitHub repo.
and if you want to run R in the Jupyter environment just follow the instructions to install and regsiter the kernel:
install.packages('IRkernel')
IRkernel::installspec()

make not found when using dynr [duplicate]

The R Package ConvCalendar is not on Cran repository anymore (see here).
However, because I have intensively used this package for previous projects, it would be nice to have it installed on my machine, even an older version would suffice.
(Windows 10 environment)
In the link above it is possible to download older versions of ConvCalendar from the archive. I thus did it, and tried installing it by running (having devtools also installed and loaded):
install.packages("ConvCalendar_1.2.tar.gz", repos=NULL, type="source")
However, I get the following error message:
> install.packages("ConvCalendar_1.0.tar.gz", repos=NULL, type="source")
Installing package into ‘C:/Users/myname/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'ConvCalendar' ...
** libs
*** arch - i386
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'ConvCalendar'
* removing 'C:/Users/myname/Documents/R/win-library/3.5/ConvCalendar'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘ConvCalendar_1.2.tar.gz’ had non-zero exit status
Looking for a solution to this problem.
what do you need is to update the Rtool, here is the link I had the same issue before once you update it will work.
Reinstall Rtools, Please check the below link to figure out the right version of Rtools.
https://cran.r-project.org/bin/windows/Rtools/history.html
'make' not found is a pretty clear cut message on what's the issue, and as noted here and elsewhere it is caused by Rterm not knowing where to find it (unlike other tools like RStudio, base R is completely clueless about the Windows registry value where the Rtools path gets set by default).
Up to Rtools 3.5 this could be neatly avoided with a checkbox in the installer (which took care of adding the right directory to PATH), but newer versions dropped it. Presumably to focus on the RTOOLS_HOME variable (which is far more independent and resilient to whatever else you may have installed on your system), if just so it wasn't that until R 4.2 nothing really cared for it in the code.
On top of that, it's only since Rtools 4.0 (maybe because they updated the old MSYS2/Cygwin environment, or maybe it was something in the accompanying R 4.0?) that you can use long filenames with spaces to point to the folder containing make. Also, hopefully you haven't been manually setting BINPREF anywhere.
TL;DR: just add something like "C:\rtools40\usr\bin" (or whatever you have) to your PATH.
Building on #mirh's answer.
I had installed Rtools 4.0 in the in "C:\rtools" on windows and had the "'make' not found" issue (I also had a warning that RTools was not found). I could not change the PATH through the traditional route though because I was missing admin rights. The following helped:
Add to your .RProfile the line:
Sys.setenv(PATH = paste0(Sys.getenv("PATH"), ";C:\\rtools40\\usr\\bin"))
This will change the path from within R for the current session. You might have to alter it if you have a different version of RTools or a different installation directory.
After this I can install from source and I don't get the RTools warning anymore.

Resources