Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStan not compatible with some Windows installations #54

Open
steveharoz opened this issue Jul 13, 2017 · 5 comments
Open

RStan not compatible with some Windows installations #54

steveharoz opened this issue Jul 13, 2017 · 5 comments
Assignees

Comments

@steveharoz
Copy link
Contributor

This bug explains why I've been having so much trouble. Paths are apparently hard coded into the source code.

Since RStan can run into "but it works on my machine" problems, I don't think it's appropriate to use in a general purpose exemplar. It looks like it's only needed for one or two functions, so let's look into alternative libraries.

@mjskay
Copy link
Member

mjskay commented Jul 13, 2017

Okay, I will see about using something like MCMCglmm or jags for that appendix in the short term.

In the long term, I think it would be a disservice to readers to introduce them to those less flexible approaches in contrast to something like brm or rstanarm, which are built on top of Stan. The more flexible approaches are half the draw of Bayesian analysis. When we do the Bayesian exemplar we will probably want to revisit this.

Looking at the bug there, it sounds like it may not be hardcoded paths, but path environment variables set improperly and/or paths with certain properties that rstan doesn't play well with (like ones with spaces and whatnot). Did you try installing rtools to c:\Rtools? I've had RStan installation issues before where installing to c:\Rtools fixed it, plus making sure I followed the steps on the rstan wiki to the letter.

Sorry you've had to deal with this. I have half a mind to open an issue on their github called something like make rstan install correctly via install.packages("rstan") and note how the cumbersome installation loses them potential users. Probably there is a more diplomatic route.

@mjskay
Copy link
Member

mjskay commented Jul 13, 2017

Also, looking at the stan instructions wiki (https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows), I see that this line might be incorrect if rtools is installed somewhere else:

cat('Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")',
    file = file.path(Sys.getenv("HOME"), ".Rprofile"), 
    sep = "\n", append = TRUE)

But the instructions do not make that clear.

@steveharoz Did you try adjusting the path when you ran that code snippet to point to wherever you had installed rtools when you went through the instructions?

If that's the culprit, I'll file an issue with the rstan folks pointing it out.

@mjskay
Copy link
Member

mjskay commented Jul 13, 2017

E.g. from my previous comment, what is the output of this?

system('where make')

Or this?

system('where make', intern = TRUE) %>% 
  strsplit("\\\\") %>% 
  unlist() %>% 
  `[`(c(-length(.) + 1, -length(.))) %>% 
  paste0(collapse = .Platform$file.sep) %>% 
  file.path("mingw_$(WIN)", "bin")

@steveharoz
Copy link
Contributor Author

steveharoz commented Jul 13, 2017

Those both show the correct path.

What cued me that something's really messed up is that c:\rtools appears nowhere in my path. I've uninstalled rstan, rcpp, and rtools and then reinstalled them. I checked that the path points to the correct location. But it still looks in c:\rtools despite that I never entered that location at any point in the setup.

Unfortunately, I can't install rtools to C for now. I'll be getting a new machine later this summer that I won't give a complicated setup.

@mjskay mjskay added this to the First guideline release milestone Dec 31, 2017
@mjskay
Copy link
Member

mjskay commented Dec 31, 2017

@steveharoz any update on this in the intervening time? I gather from that twitter conversation on Richard McElreath's book that you got Stan working. If that's the case I am leaning towards closing this. In the end stan and several packages built on it (notable rstanarm and brms) are becoming pretty popular, so I'd rather use it if possible in the Bayesian examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants