Rtools problem - unable to install packages from source

Hello. I am having a huge amount of difficulty getting rstan to install and run on a fresh R installation. I have been speaking with one of the devs here (Rstan installation troubles - #23 by Ruben222 - RStan - The Stan Forums) and it sounds like there is an issue with my rtools.

In short, it doesn't seem like I am able to install packages from source for some reason. IE running this code:

install.packages("Rcpp", type="source")

Gives this output:

Warning in install.packages : installation of package ‘Rcpp’ had non-zero exit status

Any help would be greatly appreciated as I am completely stuck.

Hi @Ruben222
It's not clear from the thread why you must install the source version of rstan. There is only a minor version change, so why not just install the "win-binary" version?
In the longer term, I would uninstall both rtools42 and rtool43, and then reinstall 43.

Hi @DavoWW. Thanks for your reply.

Unfortuntately, it sounds like I do need to install the source version. It describes the situation on the installation instructions (here RStan Getting Started · stan-dev/rstan Wiki · GitHub), but if I install using just the win-binary version and try the test model, I get this error:

Error in compileCode(f, code, language = language, verbose = verbose) :

It suggests the fix for this is installing rstan from source.

Sorry to bump this thread, but I am still completely stuck on this. I am certain there is something going wrong with my rtools, but it doesn't fix the problem by uninstalling and reinstalling.

Sys.which("make") gives this output - which I think is correct?:


But attempting to install from source always gives this error:

Warning in install.packages : installation of package ‘jsonlite’ had non-zero exit status

The other suspicious part is running: pkgbuild::check_rtools() gives:

WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.2 from RTools: Toolchains for building R and R packages from source on Windows or Index of /nosvn/winutf8/ucrt3.
Error: Rtools is not installed.

Which obviously suggests Rtools isn't installed at all, but I'm not sure why it is suggesting I install Rtools42 as I am using R version 4.3.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.