Closed ploutal7 closed 1 year ago
Seemingly, we still need to resort to #1006.
Do you mean
I've already tried (2)--it's outlined in my post. It used to work, but it doesn't with R 4.3.1 and rtools 4.3. The error I got was:
Warning: unable to access index for repository https://mc-stan.org/r-packages/bin/windows/contrib/4.3: cannot open URL ' https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES'
If you try to go to https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES, you get a 404 error. I mentioned in the post that I thought the problem might be this directory has recently been changed, e.g., the name or directory structure was changed, and now R can't find it.
Paul
On Mon, Jul 3, 2023 at 12:38 PM Liang Zhang @.***> wrote:
Seemingly, we still need to resort to #1006 https://github.com/stan-dev/rstan/issues/1006.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/1078#issuecomment-1618860423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7BAO7MM3A24IDGZ63MOLLXOLYO5ANCNFSM6AAAAAAZSOP5RU . You are receiving this because you authored the thread.Message ID: @.***>
I ignored the warning and install it anyway. Then the installation also completed, and the example works without any error.
I did that, too, and got the error you see in my post when running the 8 Schools example. Can you tell me
Thanks, Paul
On Mon, Jul 3, 2023 at 9:49 PM Liang Zhang @.***> wrote:
I ignored the warning and install it anyway. Then the installation also completed, and the example works without any error.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/1078#issuecomment-1619344811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7BAOYDITYWZ6DFGWY6WLDXONZBZANCNFSM6AAAAAAZSOP5RU . You are receiving this because you authored the thread.Message ID: @.***>
I managed to show the reprex (what you want to see is in session info) without error:
library(rstan)
#> 载入需要的程辑包:StanHeaders
#>
#> rstan version 2.26.22 (Stan version 2.26.1)
#> For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores()).
#> To avoid recompilation of unchanged Stan programs, we recommend calling
#> rstan_options(auto_write = TRUE)
#> For within-chain threading using `reduce_sum()` or `map_rect()` Stan functions,
#> change `threads_per_chain` option:
#> rstan_options(threads_per_chain = 1)
#> Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
writeLines(
"
// saved as schools.stan
data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // standard error of effect estimates
}
parameters {
real mu; // population treatment effect
real<lower=0> tau; // standard deviation in treatment effects
vector[J] eta; // unscaled deviation from mu by school
}
transformed parameters {
vector[J] theta = mu + tau * eta; // school treatment effects
}
model {
target += normal_lpdf(eta | 0, 1); // prior log-density
target += normal_lpdf(y | theta, sigma); // log-likelihood
}
",
"schools.stan"
)
schools_dat <- list(J = 8,
y = c(28, 8, -3, 7, -1, 1, 18, 12),
sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
fit <- stan(file = 'schools.stan', data = schools_dat)
#> Warning: There were 3 divergent transitions after warmup. See
#> https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#> to find out why this is a problem and how to eliminate them.
#> Warning: Examine the pairs() plot to diagnose sampling problems
Created on 2023-07-04 with reprex v2.0.2
FYI, wiki tells us to do so in Configuring-C---Toolchain-for-Windows. I think you should install Rtools 4.3 and just install rstan from source codes fetched from mc-stan.org.
remove.packages(c("StanHeaders", "rstan"))
install.packages(c("StanHeaders", "rstan"), repos = "https://mc-stan.org/r-packages/")
As I mentioned in my original post, I DID ignore those warnings--it still wouldn't run on my computer. You're using Windows 11, but I'm using Windows 10; I think that's the difference here. Paul
On Tue, Jul 4, 2023 at 8:02 AM Liang Zhang @.***> wrote:
FYI, wiki tells us to do so in Configuring-C---Toolchain-for-Windows https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows. So, afaik, it is okay to ignore those warnings.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/1078#issuecomment-1620119726, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7BAO573NWQ42CFUBY6PATXOQA6ZANCNFSM6AAAAAAZSOP5RU . You are receiving this because you authored the thread.Message ID: @.***>
You should choose to install from source not the binary one. That makes a difference.
YOU HAVEN"T READ MY ORIGINAL POST. I TRIED INSTALLING FROM SOURCE--IT DIDN"T WORK.
On Tue, Jul 4, 2023 at 7:30 PM Liang Zhang @.***> wrote:
You should choose to install from source not the binary one. That makes a difference.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/1078#issuecomment-1620828404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7BAO3AD4NYVI56E5F26W3XOSRSVANCNFSM6AAAAAAZSOP5RU . You are receiving this because you authored the thread.Message ID: @.***>
Closing issue. Am receiving comments from users who clearly have NOT read through the original post.
It is a little ill-formatted. Anyway, I am now clear you have tried both source and binary versions. Some clues are:
Summary:
Package rstan won't install properly (Windows 10); in particular, the fix that used to work stopped working with R 4.3.1.
Description:
I get an error when following the directions on the rstan installation page: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started.
Reproducible Steps:
First off, here's my system info: sysname release version machine "Windows" "10 x64" "build 19045" "x86-64" Next, my installed versions of R and rtools: R version 4.3.1 (2023-06-16 ucrt), and RTools 4.3 (rtools43-5550-5548)
Here's the R code and the error I get--this is code that USED to work with R 4.3.0 and RTools 4.3. My hunch is (based on the error I get when trying to install) that the directory at https://mc-stan.org/r-packages/ has not been set up for R 4.3.1 Windows packages yet, or maybe it's been altered recently:
There is a binary version available but the source version is later: binary source needs_compilation rstan 2.21.8 2.26.22 TRUE
At this point, a pop-up dialogue appears, and I can either compile code from source or choose not to. Doesn't make any difference which I choose--either way, I get the same error when loading and running rstan example 1 (see Current Output below).
Current Output:
make would use if test "zfile4b683c4f33ac.o" != "z"; then \ if test -e "file4b683c4f33ac-win.def"; then \ echo g++ -shared -s -static-libgcc -o file4b683c4f33ac.dll file4b683c4f33ac-win.def file4b683c4f33ac.o -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-4.3.1/bin/x64" -lR ; \ g++ -shared -s -static-libgcc -o file4b683c4f33ac.dll file4b683c4f33ac-win.def file4b683c4f33ac.o -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-4.3.1/bin/x64" -lR ; \ else \ echo EXPORTS > tmp.def; \ nm file4b683c4f33ac.o | sed -n 's/^. [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]/"&"/g' >> tmp.def; \ echo g++ -shared -s -static-libgcc -o file4b683c4f33ac.dll tmp.def file4b683c4f33ac.o -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-4.3.1/bin/x64" -lR ; \ g++ -shared -s -static-libgcc -o file4b683c4f33ac.dll tmp.def file4b683c4f33ac.o -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64" -L"C:/rtools43/x86_64-w64-mingw32.static.posix/lib" -L"C:/PROGRA~1/R/R-4.3.1/bin/x64" -lR ; \ rm -f tmp.def; \ fi \ fi Error in compileCode(f, code, language = language, verbose = verbose) : C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: file4b683c4f33ac.o:file4b683c4f33ac.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1c): undefined reference to
tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: file4b683c4f33ac.o:file4b683c4f33ac.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1c): undefined reference to
tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: file4b683c4f33ac.o:file4b683c4f33ac.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x37): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: file4b683c4f33ac.o:file4b683c4f33ac.cpp:(.text$_ZN3tbb10interface Error in sink(type = "output") : invalid connectionExpected Output:
If applicable, the output you expected from RStan.
RStan Version:
The version of RStan you are running (e.g., from
packageVersion("rstan")
)R Version:
R version 4.3.1 (2023-06-16 ucrt), and RTools 4.3 (rtools43-5550-5548)
Operating System:
"Windows" "10 x64" "build 19045"