Re: Installing RStan and Question about Instructions

158 views
Skip to first unread message

Daniel Lee

unread,
Jun 24, 2014, 11:59:30 AM6/24/14
to stan...@googlegroups.com
[moved to stan-dev]

Jiqiang/Ben,

Can we just change the installation instructions to have people download the tar.gz file and install locally from source? If so, we can just use GitHub to host.

Jiqiang, there was a second reference to google code there. I just edited the wiki removing it.






Daniel






On Tue, Jun 24, 2014 at 11:42 AM, Peter Li <li.pe...@gmail.com> wrote:
That did the trick. I'm using R 3.0.2


On Tue, Jun 24, 2014 at 11:34 AM, Jiqiang Guo <guo...@gmail.com> wrote:
Then put CXX = clang++ in your ~/.R/Makevars 

What version of R are you using?  I wonder the newest version of R for Mavericks (R-3.1.0-mavericks.pkg) has set CXX to clang++ instead of llvm-g++.

Jiqiang 


On Tue, Jun 24, 2014 at 11:28 AM, Peter Li <li.pe...@gmail.com> wrote:
Without the Makevars changes I get this error msg:

* installing *source* package ‘rstan’ ...

** package ‘rstan’ successfully unpacked and MD5 sums checked

** libs

** arch - 

llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"../inst/include/stansrc"   -isystem"../inst/include/stanlib/eigen_3.2.0"  -isystem"../inst/include/stanlib/eigen_3.2.0/unsupported"  -isystem"../inst/include/stanlib/boost_1.54.0" -I"../inst/include"  -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -ftemplate-depth-256 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"   -fPIC  -O3  -c stanc.cpp -o stanc.o

/bin/sh: llvm-g++-4.2: command not found

make: *** [stanc.o] Error 127

ERROR: compilation failed for package ‘rstan’

* removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan’


The downloaded source packages are in

‘/private/var/folders/q7/l6dsv0sx7r9d3gv1zc0_rhp40000gn/T/RtmpnbQpgu/downloaded_packages’

Warning message:

In install.packages("rstan", type = "source") :

  installation of package ‘rstan’ had non-zero exit status

> 


And with the Makevars changes I get this


* installing *source* package ‘rstan’ ...

** package ‘rstan’ successfully unpacked and MD5 sums checked

** libs

** arch - 

clang++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"../inst/include/stansrc"   -isystem"../inst/include/stanlib/eigen_3.2.0"  -isystem"../inst/include/stanlib/eigen_3.2.0/unsupported"  -isystem"../inst/include/stanlib/boost_1.54.0" -I"../inst/include"  -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -ftemplate-depth-256 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"   -fPIC  "-mtune=native  -O3 -Wall -pedantic -Wconversion -c stanc.cpp -o stanc.o

/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'

/bin/sh: -c: line 1: syntax error: unexpected end of file

make: *** [stanc.o] Error 2

ERROR: compilation failed for package ‘rstan’

* removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rstan’


The downloaded source packages are in

‘/private/var/folders/q7/l6dsv0sx7r9d3gv1zc0_rhp40000gn/T/RtmpRZlEZV/downloaded_packages’

Warning message:

In install.packages("rstan", type = "source") :

  installation of package ‘rstan’ had non-zero exit status



On Tue, Jun 24, 2014 at 11:22 AM, Jiqiang Guo <guo...@gmail.com> wrote:
Please see comments below.  
Jiqiang 


On Tue, Jun 24, 2014 at 10:54 AM, Peter Li <li.pe...@gmail.com> wrote:
I'm trying to install RStan and Mavericks and I'm getting this error over and over:

Warning: unable to access index for repository http://wiki.rstan-repo.googlecode.com/git/src/contrib/rstan_2.2.0.tar.gz/src/contrib

trying URL 'http://wiki.rstan-repo.googlecode.com/git/src/contrib/rstan_2.3.0.tar.gz'

Error in download.file(url, destfile, method, mode = "wb", ...) : 

  cannot open URL 'http://wiki.rstan-repo.googlecode.com/git/src/contrib/rstan_2.3.0.tar.gz'

In addition: Warning message:

In download.file(url, destfile, method, mode = "wb", ...) :

  cannot open: HTTP status was '403 Forbidden'

Warning in download.packages(pkgs, destdir = tmpd, available = available,  :

  download of package ‘rstan’ failed


I updated the wiki page with a new repo yesterday.  I am not sure why it seems that you saw a previous version of this page.  Try to refresh the webpage?


Also, with regards to the instructions online, it says that ~/.R/Makevars should have the following text:

CXX=g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++
but that doesn't match
if (!file.exists("~/.R/Makevars")) {
  cat('CXX=g++ -arch x86_64 -ftemplate-depth-256 -stdlib=libstdc++\n
       CXXFLAGS="-mtune=native  -O3 -Wall -pedantic -Wconversion"\n', 
       file="~/.R/Makevars");
} else {
   file.show("~/.R/Makevars");
}


If you are using xcode 5.1, you can leave all of those alone as it is for 5.0.1.  In 5.1, the default template depth is 256 and we don't need -stdlib=libstdc++.  So maybe you don't need to mess with ~/.R/Makevars at all for the most recent xcode. 
 
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Goodrich

unread,
Jun 24, 2014, 12:57:25 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 11:59:30 AM UTC-4, Daniel Lee wrote:
[moved to stan-dev]

Jiqiang/Ben,

Can we just change the installation instructions to have people download the tar.gz file and install locally from source? If so, we can just use GitHub to host.

Jiqiang, there was a second reference to google code there. I just edited the wiki removing it.

It is possible to do that but involves some extra steps and the tar.gz file is much larger than it needs to be. I think what we have been doing would be fine as long as the hosting is reliable.

Ben

To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

Daniel Lee

unread,
Jun 24, 2014, 1:00:21 PM6/24/14
to stan...@googlegroups.com
We can still upload a pruned tar.gz. We've uploaded one for CmdStan.


--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.

Daniel Lee

unread,
Jun 24, 2014, 1:02:14 PM6/24/14
to stan...@googlegroups.com
Actually, we'll need to upload a tar.gz if we want to do that. The built in tar.gz won't package up submodules.

Jeffrey Arnold

unread,
Jun 24, 2014, 1:44:07 PM6/24/14
to stan...@googlegroups.com
I think it would make sense to refactor rstan so it is installable via devtools::install_github.  This would require copying the relevant headers into the inst/include directory and commiting them into the repository, since install_github can't do submodules (as far as i know).  But the updating can be automated, memory is cheap, and the ease of installation is significant.  Here's a branch of rstan that is installable via install_github:  https://github.com/jrnold/rstan/tree/install_github.  

As I see it, the standard for R packages is be installable via CRAN, and if not CRAN, then via devtools::install_github. These days, anything else is very unusual and will probably turn off users.

Ben Goodrich

unread,
Jun 24, 2014, 1:45:14 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 12:57:25 PM UTC-4, Ben Goodrich wrote:
On Tuesday, June 24, 2014 11:59:30 AM UTC-4, Daniel Lee wrote:
[moved to stan-dev]

Jiqiang/Ben,

Can we just change the installation instructions to have people download the tar.gz file and install locally from source? If so, we can just use GitHub to host.

Jiqiang, there was a second reference to google code there. I just edited the wiki removing it.

It is possible to do that but involves some extra steps and the tar.gz file is much larger than it needs to be. I think what we have been doing would be fine as long as the hosting is reliable.

I overhauled https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started just now. Can everyone test it out ASAP and edit if I missed any corner cases?

Thanks,
Ben


Ben Goodrich

unread,
Jun 24, 2014, 2:02:03 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 1:44:07 PM UTC-4, Jeffrey Arnold wrote:
I think it would make sense to refactor rstan so it is installable via devtools::install_github.  This would require copying the relevant headers into the inst/include directory and commiting them into the repository, since install_github can't do submodules (as far as i know).  But the updating can be automated, memory is cheap, and the ease of installation is significant.  Here's a branch of rstan that is installable via install_github:  https://github.com/jrnold/rstan/tree/install_github.  

As I see it, the standard for R packages is be installable via CRAN, and if not CRAN, then via devtools::install_github. These days, anything else is very unusual and will probably turn off users.

I know. I have an unpushed branch that would allow rstan to go onto CRAN and would probably work with install_github() too. We are mostly just concerned with surviving the 2.3.0 release at the moment.

Ben

Jiqiang Guo

unread,
Jun 24, 2014, 2:30:14 PM6/24/14
to stan...@googlegroups.com

On Tue, Jun 24, 2014 at 1:45 PM, Ben Goodrich <goodri...@gmail.com> wrote:
I overhauled https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started just now. Can everyone test it out ASAP and edit if I missed any corner cases?

Thanks,
Ben

The install_rstan function only changes CXX to clang++ after installing rstan for mac.  Is that intended? The default CXX could point to llvm-g++ for old version of R. 

By the way, what do you think if we put the function in a source-able file and just call source? 

Jiqiang 

Ben Goodrich

unread,
Jun 24, 2014, 3:00:20 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 2:30:14 PM UTC-4, Jiqiang Guo wrote:

On Tue, Jun 24, 2014 at 1:45 PM, Ben Goodrich <goodri...@gmail.com> wrote:
I overhauled https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started just now. Can everyone test it out ASAP and edit if I missed any corner cases?

Thanks,
Ben

The install_rstan function only changes CXX to clang++ after installing rstan for mac.  Is that intended? The default CXX could point to llvm-g++ for old version of R. 

Yes, sort of. The llvm-g++ at least worked to install previous versions of RStan but then clang++ was needed to compile models. If llvm-g++ still installs rstan 2.3.0, then the install_rstan function should work.
 
By the way, what do you think if we put the function in a source-able file and just call source? 

That is a good idea if we can put it under http://mc.stan.org or any other place that is not https because R by default cannot source from https

Ben

Jiqiang Guo

unread,
Jun 24, 2014, 3:23:17 PM6/24/14
to stan...@googlegroups.com
On Tue, Jun 24, 2014 at 3:00 PM, Ben Goodrich <goodri...@gmail.com> wrote:
On Tuesday, June 24, 2014 2:30:14 PM UTC-4, Jiqiang Guo wrote:

On Tue, Jun 24, 2014 at 1:45 PM, Ben Goodrich <goodri...@gmail.com> wrote:
I overhauled https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started just now. Can everyone test it out ASAP and edit if I missed any corner cases?

Thanks,
Ben

The install_rstan function only changes CXX to clang++ after installing rstan for mac.  Is that intended? The default CXX could point to llvm-g++ for old version of R. 

Yes, sort of. The llvm-g++ at least worked to install previous versions of RStan but then clang++ was needed to compile models. If llvm-g++ still installs rstan 2.3.0, then the install_rstan function should work.
 

The problem is llvm-g++ does not exist in recent versions of Xcode (Peter had the problem). 

 
By the way, what do you think if we put the function in a source-able file and just call source? 

That is a good idea if we can put it under http://mc.stan.org or any other place that is not https because R by default cannot source from https

I will take care of that later.   


Ben

--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.

Ben Goodrich

unread,
Jun 24, 2014, 3:30:39 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 3:23:17 PM UTC-4, Jiqiang Guo wrote:
On Tue, Jun 24, 2014 at 3:00 PM, Ben Goodrich <goodri...@gmail.com> wrote:
On Tuesday, June 24, 2014 2:30:14 PM UTC-4, Jiqiang Guo wrote:

On Tue, Jun 24, 2014 at 1:45 PM, Ben Goodrich <goodri...@gmail.com> wrote:
I overhauled https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started just now. Can everyone test it out ASAP and edit if I missed any corner cases?

Thanks,
Ben

The install_rstan function only changes CXX to clang++ after installing rstan for mac.  Is that intended? The default CXX could point to llvm-g++ for old version of R. 

Yes, sort of. The llvm-g++ at least worked to install previous versions of RStan but then clang++ was needed to compile models. If llvm-g++ still installs rstan 2.3.0, then the install_rstan function should work.
 

The problem is llvm-g++ does not exist in recent versions of Xcode (Peter had the problem). 

Yes, but in that case, won't install_rstan() utilize clang++ automatically? If not, we can add

Sys.setenv(CXX_STD = "CXX11")

conditional on R >= 3.1.
 
By the way, what do you think if we put the function in a source-able file and just call source? 

That is a good idea if we can put it under http://mc.stan.org or any other place that is not https because R by default cannot source from https

I will take care of that later.   

Good. Thanks.

Ben

Jiqiang Guo

unread,
Jun 24, 2014, 3:40:53 PM6/24/14
to stan...@googlegroups.com

On Tue, Jun 24, 2014 at 3:30 PM, Ben Goodrich <goodri...@gmail.com> wrote:

The install_rstan function only changes CXX to clang++ after installing rstan for mac.  Is that intended? The default CXX could point to llvm-g++ for old version of R. 

Yes, sort of. The llvm-g++ at least worked to install previous versions of RStan but then clang++ was needed to compile models. If llvm-g++ still installs rstan 2.3.0, then the install_rstan function should work.
 

The problem is llvm-g++ does not exist in recent versions of Xcode (Peter had the problem). 

Yes, but in that case, won't install_rstan() utilize clang++ automatically? If not, we can add

Sys.setenv(CXX_STD = "CXX11")

I guess llvm-g++ is set for some older versions of R, which does not have the mechanism for supporting X11.  I don't know anything about R 3.1 for old Mac OS X though.
R-3.1.0-snowleopard.pkg

But actually if llvm-g++ cannot be found, the function would stop during installing Rcpp from source. 

Jiqiang 

Ben Goodrich

unread,
Jun 24, 2014, 3:46:55 PM6/24/14
to stan...@googlegroups.com
Really? I would assume that R < 3.1 would just ignore CXX_STD and try to install with the default configurations.

Ben

Jiqiang Guo

unread,
Jun 24, 2014, 4:07:38 PM6/24/14
to stan...@googlegroups.com
I thought it would stop for installing rcpp from source if CXX points to something not found.  I was wrong.  In fact, it would stop for the hello word example.  I intended set my CXX to llvm-g++-4.2, which is not available.  See below:


Selection: 1 trying URL 'http://cran.rstudio.com/src/contrib/inline_0.3.13.tar.gz' Content type 'application/x-gzip' length 14224 bytes (13 Kb) opened URL ================================================== downloaded 13 Kb trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.11.2.tar.gz' Content type 'application/x-gzip' length 2004313 bytes (1.9 Mb) opened URL ================================================== downloaded 1.9 Mb * installing *source* package ‘inline’ ... ** package ‘inline’ successfully unpacked and MD5 sums checked ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (inline) * installing *source* package ‘Rcpp’ ... ** package ‘Rcpp’ successfully unpacked and MD5 sums checked ** libs llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c Date.cpp -o Date.o make: llvm-g++-4.2: No such file or directory make: *** [Date.o] Error 1 ERROR: compilation failed for package ‘Rcpp’ * removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp’ * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp’ The downloaded source packages are in ‘/private/var/folders/q0/2jq7n1h51xlfkmjgzwcdl7540000gn/T/RtmpD8ntdj/downloaded_packages’ Attaching package: ‘Rcpp’ The following object is masked from ‘package:inline’: registerPlugin /bin/sh: llvm-g++-4.2: command not found make: *** [file10e97e48db26.o] Error 127 ERROR(s) during compilation: source code errors or compiler configuration errors! Program source: 1: 2: // includes from the plugin 3: 4: #include <Rcpp.h> 5: 6: 7: #ifndef BEGIN_RCPP 8: #define BEGIN_RCPP 9: #endif 10: 11: #ifndef END_RCPP 12: #define END_RCPP 13: #endif 14: 15: using namespace Rcpp; 16: 17: 18: // user includes 19: 20: 21: // declarations 22: extern "C" { 23: SEXP file10e97e48db26( ) ; 24: } 25: 26: // definition 27: 28: SEXP file10e97e48db26( ){ 29: BEGIN_RCPP 30: 31: std::vector<std::string> s; 32: s.push_back("hello"); 33: s.push_back("world"); 34: return Rcpp::wrap(s); 35: 36: END_RCPP 37: } 38: 39: Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! /bin/sh: llvm-g++-4.2: command not found make: *** [file10e97e48db26.o] Error 127 In addition: Warning messages: 1: In install.packages(c("inline", "Rcpp"), type = "source") : installation of package ‘Rcpp’ had non-zero exit status 2: running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file10e97e48db26.cpp 2> file10e97e48db26.cpp.err.txt' had status 1

Ben Goodrich

unread,
Jun 24, 2014, 4:22:07 PM6/24/14
to stan...@googlegroups.com
On Tuesday, June 24, 2014 4:07:38 PM UTC-4, Jiqiang Guo wrote:
But actually if llvm-g++ cannot be found, the function would stop during installing Rcpp from source. 

Really? I would assume that R < 3.1 would just ignore CXX_STD and try to install with the default configurations.



I thought it would stop for installing rcpp from source if CXX points to something not found.  I was wrong.  In fact, it would stop for the hello word example.  I intended set my CXX to llvm-g++-4.2, which is not available.  See below:

Right. I would expect it to fail if the user manually sets CXX to some compiler that does not exist on the machine.  That is why install_rstan() ignores ~/.R/Makevars . What I am unclear about is if there is some combination of OS X and Xcode where ignoring ~/.R/Makevars implies both that llvm-g++-4.2 gets used and rstan or Rcpp fails to install. If so, then we would need special instructions for that case.

Ben

 

Jiqiang Guo

unread,
Jun 24, 2014, 4:31:06 PM6/24/14
to stan...@googlegroups.com

On Tue, Jun 24, 2014 at 3:00 PM, Ben Goodrich <goodri...@gmail.com> wrote:
That is a good idea if we can put it under http://mc.stan.org or any other place that is not https because R by default cannot source from https


Jiqiang 

Jiqiang Guo

unread,
Jun 24, 2014, 4:34:20 PM6/24/14
to stan...@googlegroups.com
I think R 3.0.2 and Xcode 5.1.1 would be the case, which Peter seems to use for now.  But in this case, we could ask them to update R. 

Ben Goodrich

unread,
Jun 24, 2014, 4:47:56 PM6/24/14
to stan...@googlegroups.com, Peter Li
On Tuesday, June 24, 2014 4:34:20 PM UTC-4, Jiqiang Guo wrote:
On Tue, Jun 24, 2014 at 4:22 PM, Ben Goodrich wrote:

Right. I would expect it to fail if the user manually sets CXX to some compiler that does not exist on the machine.  That is why install_rstan() ignores ~/.R/Makevars . What I am unclear about is if there is some combination of OS X and Xcode where ignoring ~/.R/Makevars implies both that llvm-g++-4.2 gets used and rstan or Rcpp fails to install. If so, then we would need special instructions for that case.

 
I think R 3.0.2 and Xcode 5.1.1 would be the case, which Peter seems to use for now.  But in this case, we could ask them to update R. 

Peter, can you try the new steps at

https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started

again? If it fails let us know, and then try again after updating R.

Thanks,
Ben


Reply all
Reply to author
Forward
0 new messages