Fwd: Problems with RSTAN install

636 views
Skip to first unread message

Bob Carpenter

unread,
May 5, 2014, 1:58:17 PM5/5/14
to stan-...@googlegroups.com
I'm forwarding this message which came to our e-mail rather
than the mailing list (with the permission of the e-mail author,
of course).

This looks familiar, so It thought someone would know the
answer.

- Bob

Begin forwarded message:

From: Sam Weiss <samc...@gmail.com>
Subject: Problems with RSTAN
Date: May 3, 2014 at 12:19:19 PM GMT+2

Hey I Installed RSTAN exactly https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started here and getting this error when i run school code: 

TRANSLATING MODEL 'schools_code' FROM Stan CODE TO C++ CODE NOW.
COMPILING THE C++ CODE FOR MODEL 'schools_code' NOW.

 *** caught segfault ***
address 0x20, cause 'memory not mapped'

Traceback:
 1: .Call(Module__functions_names, xp)
 2: Module(module, mustStart = TRUE)
 3: .getModulePointer(x)
 4: <S4 object of class "Module">$stan_fit4model6776b37d1c0_schools_code
 5: <S4 object of class "Module">$stan_fit4model6776b37d1c0_schools_code
 6: eval(expr, envir, enclos)
 7: eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
 8: .local(object, ...)
 9: sampling(sm, data, pars, chains, iter, warmup, thin, seed, init,     check_data = TRUE, sample_file = sample_file, diagnostic_file = diagnostic_file,     verbose = verbose, algorithm = match.arg(algorithm), control = control,     ...)
10: sampling(sm, data, pars, chains, iter, warmup, thin, seed, init,     check_data = TRUE, sample_file = sample_file, diagnostic_file = diagnostic_file,     verbose = verbose, algorithm = match.arg(algorithm), control = control,     ...)
11: stan(model_code = schools_code, data = schools_dat, iter = 1000,     chains = 4)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

How can I fix this?

Sam

Rob J. Goedman

unread,
May 5, 2014, 4:20:18 PM5/5/14
to stan-...@googlegroups.com
In nearly all cases I've seen this, it happens when versions don't match, e.g. picking up old library files/packages and/or installing libraries with non-matching tools/compilers.

Sam, it looks you've gotten a bit further over the weekend, is that correct? What did you do?

Rob J. Goedman




--
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.

Fredrik Falkenström

unread,
May 26, 2014, 8:03:21 AM5/26/14
to stan-...@googlegroups.com
Dear list,

I am a newcomer to this list and to Stan. I have exactly the same problem with RStan as Sam Weiss described. I saw in another thread that someone solved it by installing an older version of R. I thought if there is another possibility I'd rather use that, so I thought I'd ask the list if anyone knows a solution (perhaps Sam has solved it)?

Best,

Fredrik Falkenström

Ben Goodrich

unread,
May 26, 2014, 3:10:13 PM5/26/14
to stan-...@googlegroups.com
Downgrading R is never really the answer. It is just a matter of getting everything aligned. The first thing to try seems to be reinstalling Rcpp from source with

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

If that is insufficient to get rstan working, then should do a

remove.packages("rstan")

and then install rstan again. If you are using the latest version of the Mac operating system, then I think you have to install rstan with CXX=g++ in ~/.R/Makevars and then change it to CXX=clang++ when you want to run models.

Ben

Fredrik Falkenström

unread,
May 27, 2014, 2:08:41 AM5/27/14
to stan-...@googlegroups.com
Thank you very much Ben, it was sufficient just to reinstall Rcpp.

Best,

Fredrik


--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/XAlXvXsurdM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.

Rob Trangucci

unread,
Jun 9, 2014, 5:09:58 PM6/9/14
to stan-...@googlegroups.com
Hey all,

I just wanted to alert the list that I just installed RStan on a new Mac (Mavericks, latest Xcode) and had a similar problem to Fredrik and Sam compiling the 8 schools code . I followed the instructions on the RStan Getting Started page and had R crash on me when I tried to run the 8 schools example. I followed Ben's instructions above to reinstall Rcpp and inline (copy/pasted Ben's above into the R console) from source, and the 8 schools code now runs fine. Given that a few other users have had similar problems, I wonder if there is a versioning issue with what R installs when install.packages(c('Rcpp','inline')) is called vs. install.packages(c('Rcpp', 'inline'), type = 'source').

Rob

Michael Margolis

unread,
Jun 18, 2014, 4:44:49 PM6/18/14
to stan-...@googlegroups.com
I'm having a similar issue, and since I have the latest Mac OS I thought I should try following this advice:


If you are using the latest version of the Mac operating system, then I think you have to install rstan with CXX=g++ in ~/.R/Makevars and then change it to CXX=clang++ when you want to run models.

 I don't know how to that  -- the "install with" looks like it might be a parameter setting in install.packages(), but then how would I change it?

Thanks,
Michael

Luc Coffeng

unread,
Jun 18, 2014, 9:59:36 PM6/18/14
to stan-...@googlegroups.com
Hi Michael,

You need to find the file "Makevars" that is in the folder ~/.R/ (where "~" is something like usr/[username]). ".R" starts with a period, so this indicates it is a hidden folder. You can't find it with finder, unless you do some tweaks. See here how to do that.

Btw, I recently got a new Macbook Pro, and I was able to successfully install rstan with CXX=clang++ in my Makevars file (and having installed inline and Rcpp from source).

Luc

Michael Margolis

unread,
Jun 19, 2014, 8:04:49 AM6/19/14
to stan-...@googlegroups.com
Thanks, Luc. I added the line
CXX=clang++
to Makevars. The problem remains. I am off to start a new thread called "Vignette Failure".
Reply all
Reply to author
Forward
0 new messages