-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Cannot connect brms or rstan to Stan [Error in compileCode(f, code, language = language, verbose = verbose) : Error in sink(type = “output”) : invalid connection] #1082
Comments
@krisanathema not sure if you saw this https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows#r-43 however, when I attempt to run
I get this error
which indicates that it's defaulting back to CRAN and when I try to install using this
I get this error:
so even following the walk though I am getting similar errors |
Hi kylearmstrong! Thanks for your message. Yes, exactly, I also looked into this thread, as I was expecting it to be the official procedure and solution to my problem. But this does not work neither... I have no clue :-( |
Sorry you're having such a hard time here. I wish we knew how to fix Windows and R environments so they were easier for our users. The combination has given us more work than everything else put together. Windows just had to make everything different enough that the usual Unix solutions that work on Linux and Mac OS X fail on Windows. R has also proved challenging given the restrictive policies of CRAN and lack of dependency management. Things are particularly challenging right now as our R dev team's trying to push through a new version of RStan, but it's not been easy without dependency management. One way to get around all these problems with Windows without getting new hardware is to use the Windows Subsystem for Linux: https://learn.microsoft.com/en-us/windows/wsl/install It does look like your current RStan version is our latest stable version (2.21) library("rstan") # observe startup messages
...
rstan (Version 2.21.8, GitRev: 2e1f913d3ca3) but then you're trying to install our latest version (2.26). > install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos"))) I'm not sure why that's going through mc-stan.org rather than through GitHub. I believe CRAN had 2.26 for a while and then it got reverted back to 2.19. brms is listed at a version 2.19 with a dependency on rstan (≥ 2.19.2). It might be better to use an older version of RStan if all you're trying to do is run brms. What we really need to do is get rid of the rstan dependency in brms so that it just depends on cmdstanr, which is non-trivial to install, but easier than rstan. |
P.S. This should probably be an issue in the brms repo as it's fundamentally a problem installing brms. |
In addition to Bob’s comment:
* brms can now run with cmdstanr if you can install cmdstanr and cmdstan
(see mc-stan.org/cmdstanr). You have to specify backend="cmdstanr" when
running brms.
* you could try installing StanHeaders and RStan from source instead of
binaries. See my reply here:
https://discourse.mc-stan.org/t/cannot-compile-stan-program-from-r-package-brms/32294/
…On Mon, Jul 31, 2023 at 2:49 PM Bob Carpenter ***@***.***> wrote:
P.S. This should probably be an issue in the brms repo as it's
fundamentally a problem installing brms.
—
Reply to this email directly, view it on GitHub
<#1082 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3PQQ6BUKP7LF3J7TSSQITXTAK4LANCNFSM6AAAAAA23ZOLXA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks @bob-carpenter and @jgabry. I understand that the relationship between Windows, R and Stan is complicated and I am sorry for that.
I will try to keep brms working on my personal computer.... and hope for the best for my tutorial on Thursday [thankfully not entirely devoted to the Bayesian approach]. I could also not install StanHeaders and RStan from source:
But actually, all files for each package are located in a Temp folder: C:\Users\UserName\AppData\Local\Temp\Rtmpw1ZmPV\downloaded_packages
Maybe I should do something with these files and put them somewhere else on my computer? When I afterwards run
But, overall,
|
Have you installed the C++ toolchain using R tools and verified your C++ environment is working? Is I'm afraid I don't know how to check either of these things in Windows. |
I thought that was what was done when following these steps: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows |
That page starts with a compatibility warning that the latest RTools versions only work with RStan 2.26, which you need to get from GitHub rather than CRAN. So if you want to keep using RStan 2.21, as is on CRAN, you'll need to install an older version of RTools, like RTools4. Then you want to make sure that the C++ is working and you can compile and execute a C++ program using the tools. If you can't do that, you won't be able to run RStan or CmdStanR. This link [ https://cran.r-project.org/bin/windows/Rtools/rtools40.html ] contains instructions on how to test if the installation can access |
This seems bad and I'm not sure how rstan is still on CRAN if it can't compile on Windows from CRAN sources. Without rstan, brms will fail and all the packages that depend on both. |
@bgoodri how's the rstan 2.26 submission going? |
Summary:
I cannot connect to Stan from R, and therefore I cannot use the packages
rstan
orbrms
, for instance. The message error is always:with not a single line afterwards [seems to differ from other reported issues].
Description:
I try to run
brms
as usual a few days ago and then realized it was not working. I already had some issues in the past, but I somehow managed to deal with it. It seems like updating R is always an issue forrstan
. I do not really get why. Currently, I can runbrms
on my personal laptop and I have issues with my work laptop. I generally keep both of them as updated as possible with regards to R, RStudio or R packages.I have no clue what is the problem this time. I spent days trying to understand that. I went through many pages on the web for help [for instance here, here, here, or even here].
The solutions often appear to be somehow similar, but none of them work in my case.
As I am afraid that
brms
also stops working on my personal PC, I do not dare to look into the installation configuration on my personal PC. But I typically have very similar configurations on both PCs.Reproducible Steps:
So I tried to uninstall all installations of R, RStudio, RTools, as well as deleting all associated folders, clearing all associated paths in the
System environment variables of my PC, but nothing has helped: always the same issue.
Current Output:
To be more specific with
brms
:Expected Output:
RStan Version:
2.21.8
R Version:
R version 4.3.1 (2023-06-16 ucrt)
Operating System:
Windows 10
The text was updated successfully, but these errors were encountered: