stan-dev / stan-dev/rstan

Unable to run 8schools on Windows 10, Microsoft R Open 3.5.3, RBuildTools 3.5

Open
#686 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Trying to run the "hello world" 8 schools fitting model on Windows 10 Microsoft R Open installation fails.

Description:
Reproducible Steps:

See steps above.

In particular:

install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
pkgbuild::has_build_tools(debug = TRUE)

library("rstan") # observe startup messages
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
Sys.setenv(LOCAL_CPPFLAGS = '-march=native')

# Sample data
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))


# Estimate model with stan.
fit <- stan(file = '8schools.stan', data = schools_dat)

My output from pkgbuild:

> pkgbuild::has_build_tools(debug = TRUE)
Scanning R CMD config CC...
cc_path:  
'.exe' does not exist
Scanning path...
Scanning registry...
Found C:/RBuildTools/3.5 for 3.5 
VERSION.txt
Rtools version 3.5.0.4 
[1] TRUE
Current Output:
> fit <- stan(file = '8schools.stan', data = schools_dat)
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from C:/Users/moadmin/Documents/R/win-library/3.5/BH/include/boost/random/detail/integer_log2.hpp:19:0,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/BH/include/boost/random/detail/int_float_pair.hpp:26,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/BH/include/boost/random/exponential_distribution.hpp:27,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/BH/include/boost/random/gamma_distribution.hpp:25,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_rng.hpp:5,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/StanHeaders/include/stan/math/prim/mat.hpp:292,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from C:/Users/moadmin/Documents/R/win-library/3.5/StanHeaders/include/stan/
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command 'C:/src/R/R353/bin/x64/R CMD SHLIB file27f87d1f6909.cpp 2> file27f87d1f6909.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
Expected Output:

Fitted model object.

RStan Version:

2.19.2

R Version:

Microsoft R Open 3.5.3 which is equivalent to R 3.5.3

Operating System:

Windows 10 Enterprise 1803, OS build: 17134.950

Other Info
  • I am running under admin privileges (when I run under a regular account, the above also happens)
  • Unless I execute: options(buildtools.check = NULL) then RStudio keeps bugging me to install Rtools but that seems to be a red herring: https://github.com/rstudio/rstudio/issues/3563
  • Since I am on Windows, I have cygwin installed with gcc --version 7.4.0. Although RBuildTools on windows comes with mingw so that shouldn't be a problem I suppose.
  • I am running from behind a corporate proxy setup, but I can't imagine that's a problem here...

Please tell me what I can do to debug/fix this issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the 8schools.stan example on Windows 10 with Microsoft R Open 3.5.3 and RBuildTools 3.5, starting with pkgbuild::has_build_tools(debug = TRUE) and the reported stan() call. Inspect the complete compiler output behind the R CMD SHLIB failure; done means the example compiles and returns a fitted model object.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.