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.
Related
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!
The message indicates RTools isn't installed properly. Download and install it like so:
Go here
Download rtools
Find the file that just downloaded
Double click on it to start installation
Close and reopen RStudio
Everything should work now!
A nice 2-minute video explainer can be found here.
Why is RTools necessary in the first place?
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 have installation problems
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.
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.
if your os is windows, you should install rtool to create a building env for some R packages.
full stack for install R Rstudio Rtool .
you can get answer from this video https://www.bilibili.com/video/BV1Mv411u7Cm?spm_id_from=333.999.0.0
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
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!
The message indicates RTools isn't installed properly. Download and install it like so:
Go here
Download rtools
Find the file that just downloaded
Double click on it to start installation
Close and reopen RStudio
Everything should work now!
A nice 2-minute video explainer can be found here.
Why is RTools necessary in the first place?
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 have installation problems
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.
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.
if your os is windows, you should install rtool to create a building env for some R packages.
full stack for install R Rstudio Rtool .
you can get answer from this video https://www.bilibili.com/video/BV1Mv411u7Cm?spm_id_from=333.999.0.0
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.
My Fedora system (Fedora 20, all up to date) has just had R updated to version 3.1.0. Since then, I've had issues installing multiple packages. glmnet failed previously, and now I'm having trouble with treemap. More specifically, I get an error during treemap installation that httpuv has zero exit status.
I never had issues with the previous version of R. Any reason this version should have such problems??
There could be many causes to do with your OS, version, permissions, other installed packages/software, etc, etc. Without seeing the full error message it's hard to know.
One possibility specific to httpuv is root privileges. I've noticed a few threads on various forums when searching for installation errors with this package and Linux, many of them mentioning root v. non-root issues. In another case, libuv needed to be upgraded.
I encounter package installation problems daily and I have some more general work-arounds as well. Hopefully one of these will solve your problem.
Install the package from source
download.file(url="http://cran.r-project.org/src/contrib/httpuv_1.3.0.tar.gz", destfile = "httpuv.tar.gz")
install.packages("httpuv.tar.gz", type = "source", repos = NULL)
Install using devtools via GitHub if the package supports it
Install RTools and re-try your package installation
Install an older version of the package
If those above do not work, then I dig deeper by referring to advice given to me by a VP of IT in my company. These comments were made in reference to frequent package installation problems I encountered when switching from Windows to Solaris:
There are two types of install/make problems. Missing .h files
and/or missing .so/.a libs. The reason for these are multiple:
1.- the package that delivers these is not installed. This means that those files cannot be found anywhere in the /usr tree. Solution is
install right package, make sure the files are there
2.- the includes are not found by the install configurator. This means some environment variable or install option is not properly set (this
is our case for RODBC). Figuring out which variable to set is
challenging without looking at the package documentation [fortunately, documentation is not hard to find!]
3.- the libs are not in the LD_LIBRARY_PATH, easy to fix.
4.- There is a deeper compile/link error, meaning the package is not compatible with the rest of the sw, or has not been properly ported.