Open charlesm93 opened 7 years ago
I think I found a fix, which is mildly elegant. I could do something simpler with:
install_version("rstan", version = "2.14.1", repos = "http://cran.us.r-project.org")
but this procedure overwrites the version of StanHeaders
the installation script edits to include Torsten. Any way to prevent rstan from doing this?
The following has been tested on mac and produces the desired results:
setupRTorsten.R
. pkgSetup.R
and the pkg directory (which contains the file rstan_2.14.2.tar.gz
are in the R directoryMy understanding is that we need to ensure rstan_2.14.1
and its associated StanHeaders_2.14.0
are used together with Torsten
. My workaround is below, and works for me.
Install rstan
as usual (https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows). This will make sure that the necessary dependent packages for rstan
are installed. But note that version of rstan_2.15.1
is to be installed as of today (April-26-2017).
I then used your suggested script below to install Torsten
. Note that when rstan_2.14.1
is installed at the last step , the dependencies won't get installed as repos = NULL
. Otherwise StanHeader_2.14.0
that is edited by Torsten
will be overwritten by the latest production version (i.e., StanHeader_2.15.0
as of April-26-2017).
## Install RStan, with Torsten built inside of it.
libdir <- file.path("C:/Users/XingSu/Documents/R/win-library/3.3") .libPaths(libdir) library(devtools)
install.packages("https://cran.r-project.org/src/contrib/Archive/StanHeaders/StanHeaders_2.14.0.tar.gz", repos = NULL) setwd(libdir) system("git clone https://github.com/charlesm93/stan.git") setwd("stan") system("git checkout torsten-master") setwd(libdir) system("rm -rf StanHeaders/include/src/stan") system("mv stan/src/stan StanHeaders/include/src/stan") system("rm -rf stan") system("git clone https://github.com/charlesm93/math.git") setwd("math") system("git checkout torsten-master") setwd(libdir) system("rm -rf StanHeaders/include/stan") system("mv math/stan StanHeaders/include/stan") system("rm -rf math")
install.packages("https://cran.r-project.org/src/contrib/Archive/rstan/rstan_2.14.1.tar.gz", repos = NULL)
Nice! This is a more elegant approach and doesn't require running pkgSetup.R
. The repos = NULL
argument was what I was missing. I wonder if we can install all dependencies, except StanHeaders when downloading rstan. That would avoid having to install rstan twice.
A user found an error with
SetupRTorsten.R
.The error results from the release of rstan version 2.15 and the fact Torsten is currently built in Stan 2.14. I need to update the installation file so that it picks a version of Stan Torsten has been tested with. The packages get installed and loaded. However, when trying to run a stan file, the following error message appears after compilation: