Rtools 4.0

0 views
Skip to first unread message

Rita Seliba

unread,
Aug 4, 2024, 11:28:25 PM8/4/24
to verbstearulhot
Ijust 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 -project.org/bin/windows/Rtools/ ( installed version 3.5) into C:\Rtools. In installation I had the path variable option checked.


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.


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.


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 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.


If you are an organization using Chocolatey, we want your experience to be fully reliable. Due to the nature of this publicly offered repository, reliability cannot be guaranteed. Packages offered here are subject to distribution rights, which means they may need to reach out further to the internet to the official locations to download files at runtime.


Fortunately, distribution rights do not apply for internal use. With any edition of Chocolatey (including the free open source edition), you can host your own packages and cache or internalize existing community packages.


Rtools is the toolchain bundle that is used on Windows to build R base and R packages that contain compiled code. You only need Rtools if you want to compile R packages from source that contain C/C++/Fortran. By default, R for Windows installs the precompiled binary packages from CRAN, for which you do not need rtools. This Chocolatey package works with the installation defaults, which consist of the standard toolchains based on gcc (32/64 bit mingw-w64) and build utilities (make, bash, tar, sed, etc).


In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).


To build binary packages on windows, Rtools (found at -project.org/bin/windows/Rtools/) needs to be onthe path. The default installation process does not add it, so thisscript finds it (looking first on the path, then in the registry).It also checks that the version of rtools matches the version of R.has_rtools() determines if Rtools is installed, caching the results.Afterward, run rtools_path() to find out where it's installed.


You most likely will not want an R shortcut on your desktop, as you will almost certainly use RStudio as an interface. You can still have one if you would like. Otherwise, accept the defaults and hit Next >.


Over time updates to R and R Studio will necessitate and update. Packages you use may not update with R! If you rely heavily on a package for a project, it is highly recommended you save your current configuration of R and R Studio before updating. If there was a major version change, you will also need to re-install all of your packages. Upgrading R and R Studio follows the same process as installing it in the first place. You can simply install the new versions on your machine. As long as you do not remove the old instances of R as part of this process, you would be able to revert to a previous version.


If you are installing R/RStudio on a Mac, there is no extra configuration. Simply go the download pages for R and RStudio and choose the latest version for mac. Run the installer package when it is finished downloading. If you receive an error regarding the app being from an unidentified developer, please follow the instructions here.


Once you have installed both R and RStudio, you should be able to run RStudio on your machine. You can verify your install is working by opening RStudio and typing paste("Hello World!") into the console as shown below. If the code runs you should see a response that says [1] Hello World!. If that works you are all set!


R packages are community made functions that automate or expand the things you can do in the R language. The process for installing them is largely the same for both Windows and Mac. There are three main methods for installing R packages. You can install them from the Comprehensive R Archive Network (CRAN) from within R, from another online source like Github, or from files on your local machine. We will cover each of these methods here.


The vast majority to packages in R can be installed from CRAN. You will need the name of the package you want to install. Once you have the name (case sensitive!), you can download it from within R using the install.packages() function in the R console.


For example, if you wanted to install the skimr package, you would enter install.packages("skimr"). Note that you do need to put the package name in quotes, and that it is case sensitive. You can install multiple packages at a time by passing a vector of package names to install.packages(), for example: install.packages(c("skimr", "corrplot")).


Not all packages are available on CRAN, especially very new or very old packages. For these you will most likely need to install them from an online repository, the most common of which is Github. There are some R packages that make this process easy. We will use the remotes package.


R Tools is a bundle of programs on Windows that allows R to build packages from local source files, rather than installing through CRAN. The vast majority of the time this is unnecessary, but some circumstances require it. Mac users do not need to install R Tools.


To verify R tools was installed successfully, first restart R to assure you are in a clean environment. You can do this by closing and re-opening your R or RStudio window. Afterwards, type Sys.which("make") (case sensitive!) into the console. If you see "C:\\rtools40\\usr\\bin\\make.exe" as a result you are all good!


The package rtools provides utilities that are of general usagefor developing software that use the RPy2 package. This is not a replacement ofRPy2 but rather an addon to simplify the life of developerswho are using R packages from Python.


This document is now only about a system for testing updates to Rtools on Windows. It is intended for Rtools maintainers, could be of interest to people automating R package checks or R enthusiasts at large, but is not of general interest to R users nor R package authors.


The ucrt3 system was created to enable the transition to UTF-8 as the native encoding in R on Windows, which required switching to UCRT as the C runtime, a new toolchain, and updates to R and R packages. This document provided instructions on how to build the experimental versions of R and R packages, how to update R packages to be compatible, how to build the new toolchain and how to contribute to it.


From March, 2021, the system implemented automated builds and testing. Usually several times a week it would provide builds of the new toolchain, a patched version of R-devel, patched versions of CRAN and required Bioconductor packages, and checks of CRAN packages. The check results were integrated into CRAN website, so available for each CRAN package. Later this involved also regular builds of the Rtools installer.


From December 13, 2021, R-devel has been switched to UCRT on Windows. The ucrt3 patches for R were merged into R-devel and the CRAN checks of R-devel were switched to the new toolchain, Rtools42. From this time, this document was used by package authors who needed to change their R packages to work on Windows and the ucrt3 system was still running as an alternative to the main CRAN checks. It has been still used to build new versions of Rtools42 and R-devel snapshots and it served R (CRAN and Bioconductor) package patches that were installed automatically at package installation time by R-devel.

3a8082e126
Reply all
Reply to author
Forward
0 new messages