Can't install rstan on R 3.1.0?

1,277 views
Skip to first unread message

pw

unread,
Mar 31, 2016, 11:13:35 PM3/31/16
to Stan users mailing list
I am trying to install rstan on R 3.1.0 (using a mac). I have tried to do what is documented on the github page but it tells me that rstan won't work on R 3.1.0. The github page indicates that you just need to be using anything higher than R 3.0.2, so that doesn't really make sense to me. I have read the other threads here on this issue and have tried to use the approaches indicated but they wont work either.

Any ideas or am I out of luck?

Thanks!


pw

Ben Goodrich

unread,
Mar 31, 2016, 11:51:40 PM3/31/16
to Stan users mailing list
On Thursday, March 31, 2016 at 11:13:35 PM UTC-4, pw wrote:
I am trying to install rstan on R 3.1.0 (using a mac). I have tried to do what is documented on the github page but it tells me that rstan won't work on R 3.1.0. The github page indicates that you just need to be using anything higher than R 3.0.2, so that doesn't really make sense to me. I have read the other threads here on this issue and have tried to use the approaches indicated but they wont work either.

It may work. What specifically does it say when you try to install the binary on 3.1.0? What if you do

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

?

Ben

pw

unread,
Apr 1, 2016, 12:20:37 AM4/1/16
to Stan users mailing list
Thank you, Ben.

I tried your approach and R was taking awhile to run through everything. I thought maybe it would work this time; however it failed.

This was the warning message this time (which is much more than I was getting for a warning message using the previous approaches):

Warning messages:
1: In install.packages("rstan", type = "source") :
  installation of package ‘RcppEigen’ had non-zero exit status
2: In install.packages("rstan", type = "source") :
  installation of package ‘rstan’ had non-zero exit status



Any ideas what I can try from here? Not sure why this library is so difficult to acquire as it seems like others have had similar issues?

pw

Ben Goodrich

unread,
Apr 1, 2016, 12:51:28 AM4/1/16
to Stan users mailing list
On Friday, April 1, 2016 at 12:20:37 AM UTC-4, pw wrote:
  installation of package ‘RcppEigen’ had non-zero exit status
 
Need to figure out why RcppEigen failed to install. There should be more information about that if you scroll up, or if you try to install RcppEigen specifically.

Ben

pw

unread,
Apr 1, 2016, 12:54:23 AM4/1/16
to Stan users mailing list
I'll try and install RccpEigen on it's own and then try rstan. If it helps, here was what the error about it said:

ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
collect2: ld returned 1 exit status
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppEigen’
* installing *source* package ‘BH’ ...
** package ‘BH’ successfully unpacked and MD5 sums checked
** inst
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (BH)
* installing *source* package ‘StanHeaders’ ...
** package ‘StanHeaders’ successfully unpacked and MD5 sums checked
** inst
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (StanHeaders)
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
Warning: /private/var/folders/mq/rsrk1_9x481g8cbxg9x8g8z40000gn/T/Rtmp1Qg4n6/R.INSTALL12c522af450c/ggplot2/man/reexports.Rd: docType ‘import’ is unrecognized
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ggplot2)
ERROR: dependency ‘RcppEigen’ is not available for package ‘rstan’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan’

Ben Goodrich

unread,
Apr 1, 2016, 10:46:04 AM4/1/16
to Stan users mailing list
On Friday, April 1, 2016 at 12:54:23 AM UTC-4, pw wrote:
I'll try and install RccpEigen on it's own and then try rstan. If it helps, here was what the error about it said:

ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
collect2: ld returned 1 exit status
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’

It shouldn't be trying to link to a Fortran library when compiling RcppEigen. What is

cat(readLines("~/.R/Makevars"), sep = "\n")

?

Ben
 

Jiqiang Guo

unread,
Apr 1, 2016, 10:59:53 AM4/1/16
to stan-...@googlegroups.com
Try to install rcppeigen' binary version.  It might need a fortran compiler for installing rcppeigen from source.

Jiqiang 
--
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.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bob Carpenter

unread,
Apr 1, 2016, 1:17:20 PM4/1/16
to stan-...@googlegroups.com
One would hope not because RcppEigen is 100% C++.

- Bob

Jiqiang Guo

unread,
Apr 1, 2016, 2:49:11 PM4/1/16
to stan-...@googlegroups.com
Right.  But seemingly it needs library gfortran as indicated in previous error message.  I suppose typically you have library gfortan (file libgfortran.so or libgfortran.a) only after installing the Fortran compiler in GCC.  

Since RStan only use the header files in package RcppEigen, installing a binary version of package RcppEigen is totally fine before installing rstan from source. 

Jiqiang 

Bob Carpenter

unread,
Apr 1, 2016, 3:32:21 PM4/1/16
to stan-...@googlegroups.com
It says on the CRAN page that it imports Matrix and Rcpp,
but doesn't mention Fortran. Relying on a Fortran compiler
seems like a mistake; any idea what they use it for?

rstan and StanHeaders are listed as "Reverse suggests". How
does "suggests" differ from "depends" and "imports", which are
listed separately?

On the RStan page on CRAN, it says rstan imports Rcpp.

- Bob

Ben Goodrich

unread,
Apr 1, 2016, 3:42:12 PM4/1/16
to Stan users mailing list
On Friday, April 1, 2016 at 3:32:21 PM UTC-4, Bob Carpenter wrote:
rstan and StanHeaders are listed as "Reverse suggests".  How
does "suggests" differ from "depends" and "imports", which are
listed separately?

pw

unread,
Apr 2, 2016, 1:14:18 PM4/2/16
to Stan users mailing list
Okay, I got it to work. For anyone else who is having similar issues, what I did was install RcppEigen first using:

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

That got RcppEigen installed and then from there I could install rstan without issue.

Thanks!

pw

Scott Akenhead

unread,
Apr 28, 2016, 10:52:21 PM4/28/16
to Stan users mailing list
I am grateful that you fought your way through this and reported what worked. I had the same problem (rstan was missing RcppEigen) and was baffled by the voluminous output from a crashing stan_model.  Went through the usual ritual: reinstall OS, Xcode, R. Start R, update all, install rstan, wave an amethyst  crystal.  Still kablooey.  Found this thread just before sacrificing a chicken.  After installing RcppEigen, then installing rstan, then restarting R, it worked. I guess it is a simple as: RcppEigen is a dependency for rStan.  Anyway, thanks!

Bob Carpenter

unread,
Apr 29, 2016, 3:32:45 AM4/29/16
to stan-...@googlegroups.com
I hope you were kidding about reinstalling the OS. I
don't think that's ever going to be the problem.

When you tried to install Stan, did you set dependencies,
as in:

> install.packages("rstan", dependencies = TRUE)

I think that's the magic incantation, as indicated here:

https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-install-rstan

As far as I know, there's no way to have install.packages() indicate
a problem if the "dependencies = TRUE" bit is missing. But I'm not
an R expert and suggestions for making the installs more reliable are
more than welcome.

- Bob
Reply all
Reply to author
Forward
0 new messages