slp
slp

Reputation: 341

Rtools is required to build R packages but is not currently installed

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!

Upvotes: 34

Views: 119694

Answers (5)

Suresh G
Suresh G

Reputation: 1

You need two things in order

  1. install R
  2. install R Studio

Then, go to this link - https://cran.r-project.org/bin/windows/base/howto-R-devel.html Search "Rtools" in the above web page. Click on the hyperlink "installer" to install Rtools44. Open R (not R Studio) & install the rest given in order:

  1. install.packages("PKI", type="source") & run the packages e.g., library(PKI)
  2. install.packages(devtools) & run the package. This installs all the dependent packages under Rtools.
  3. devtools::install_github("PolMine/RcppCWB") & finally the below one
  4. download.packages("tiff", destdir=".")
  5. tools::Rcmd("check tiff_0.1-11.tar.gz") # update file name as needed

No setting of PATH is necessary, Rtools44 will be found automatically by R. You can check now for packages like "psych" by running library(psych). Packages with dependencies should all work now well.

Now open R Studio and you can work on such dependent (C++) libaries.

Upvotes: 0

Jakub Jędrusiak
Jakub Jędrusiak

Reputation: 467

If somoeone is still looking, be sure to check if you use the right version of Rtools. E.g. if you have R 4.3.3 install Rtools43 not Rtools44.

Upvotes: 2

Cécile
Cécile

Reputation: 11

In my case, I had done all of that but it didn't work so I deleted the entire "C:\Program Files\R" files and reinstalled R. I actually had two previous versions of R and Rtools and packages were not installed in the same folders

Upvotes: 1

stevec
stevec

Reputation: 52847

The message indicates RTools isn't installed properly. Download and install it like so:

  1. Go here
  2. Download rtools
  3. Find the file that just downloaded
  4. Double click on it to start installation
  5. Close and reopen RStudio
  6. Everything should work now!

A nice 2-minute video explainer can be found here.


Why is RTools necessary in the first place?

Rtools adds are some tools to allow you to build packages. Not all packages need it; just the ones that use C, C++ or Fortran code.


If you have problems installing

  • If the instructions above don't result in a successful installation of Rtools, the following may help.
  • 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.

Upvotes: 15

yuanzz
yuanzz

Reputation: 1966

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

Upvotes: 0

Related Questions