Open Jinghaoma opened 5 years ago
hi rstan folks,
a jamovi dev here. we bundle a build of R with jamovi, and run analyses from many packages with it. it appears that rstan assumes something which isn't true in the case of R inside jamovi, but i'm not sure what it is. could you guys shed some light on it?
with thanks
Can someone with jamovi try it with rstan 2.18.2 from CRAN and specify the verbose = TRUE argument to stan() or sampling()?
On Sun, Nov 11, 2018 at 1:46 AM Jonathon Love notifications@github.com wrote:
hi rstan folks,
a jamovi dev here. we bundle a build of R with jamovi https://www.jamovi.org, and run analyses from many packages with it. it appears that rstan assumes something which isn't true in the case of R inside jamovi, but i'm not sure what it is. could you guys shed some light on it?
with thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/584#issuecomment-437647753, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqm5CwWp9Iadx7HtJct7jf0HYjfb6ks5ut8fVgaJpZM4YYWJy .
here's the output, the whole thing, or abridged:
TRANSLATING MODEL '7c2c0c530925eae2265e7121e1b92f6d' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '7c2c0c530925eae2265e7121e1b92f6d'.
OS: x86_64, mingw32; rstan: 2.18.2; Rcpp: 0.12.19; inline: 0.3.15
>> setting environment variables:
PKG_LIBS = -L"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/libs/x64" -lStanHeaders
PKG_CPPFLAGS = -I"C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/library/Rcpp/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/RcppEigen/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/RcppEigen/include/unsupported" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/BH/include" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/include/src/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -std=c++1y
>> Program source :
1 :
2 : // includes from the plugin
3 : // [[Rcpp::plugins(cpp14)]]
4 :
5 : // user includes
6 : #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.18.0
7 :
8 : #include <stan/model/model_header.hpp>
9 :
10 : namespace modelcd423434754_7c2c0c530925eae2265e7121e1b92f6d_namespace {
11 :
<snip>
546 :
547 : // declarations
548 : extern "C" {
549 : SEXP filecd453692790( ) ;
550 : }
551 :
552 : // definition
553 :
554 : SEXP filecd453692790( ){
555 : return Rcpp::wrap("7c2c0c530925eae2265e7121e1b92f6d");
556 : }
557 :
558 :
Compilation argument:
C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/bin/x64/R CMD SHLIB filecd453692790.cpp 2> filecd453692790.cpp.err.txt
and the stacktrace:
stan(model_code = mode, data = stan_data, iter = 27000, warmup = 2000, chains = 1, cores = 1, verbose = T)
stan_model(file, model_name = model_name, model_code = model_code, stanc_ret = NULL, boost_lib = boost_lib, eigen_lib = eigen_lib, save_dso = save_dso, verbose = verbose)
cxxfunctionplus(signature(), body = paste(" return Rcpp::wrap(\"", model_name, "\");", sep = ""), includes = inc, plugin = "rstan", save_dso = save_dso | auto_write, module_name = paste("stan_fit4", model_cppname, "_mod", sep = ""), verbose = verbose)
pkgbuild::with_build_tools(cxxfunction(sig = sig, body = body, plugin = plugin, includes = includes, settings = settings, ..., verbose = verbose), required = rstan_options("required") && !identical(Sys.getenv("WINDOWS"), "TRUE") && !identical(Sys.getenv("R_PACKAGE_SOURCE"), ""))
withr::with_path(rtools_path(), code)
force(code)
cxxfunction(sig = sig, body = body, plugin = plugin, includes = includes, settings = settings, ..., verbose = verbose)
compileCode(f, code, language = language, verbose = verbose)
readLines(errfile)
file(con, "r")
i gather an error is occurring, and the error is supposed to be written to filecd453692790.cpp.err.txt
, but it isn't. if i look in my temp dir, the filecd453692790.cpp
file is there, but not the error file.
with thanks
jonathon
if i run the command manually (having set the environmental variables):
C:\Users\jonathon\AppData\Local\Temp>C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/bin/x64/R CMD SHLIB filecd453692790.cpp
i get:
C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/etc/x64/Makeconf:230: warning: overriding recipe for target '.m.o'
C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/etc/x64/Makeconf:223: warning: ignoring old recipe for target '.m.o'
c:/Rtools/mingw_64/bin/g++ -I"C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/include" -DNDEBUG -I"C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/library/Rcpp/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/RcppEigen/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/RcppEigen/include/unsupported" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/BH/include" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/include/src/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/include/" -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -std=c++1y -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c filecd453692790.cpp -o filecd453692790.o
filecd453692790.cpp:8:39: fatal error: stan/model/model_header.hpp: No such file or directory
#include <stan/model/model_header.hpp>
^
compilation terminated.
C:/Users/jonathon/Downloads/jamovi-0.9.5.8-win64/Frameworks/R/etc/x64/Makeconf:215: recipe for target 'filecd453692790.o' failed
make: *** [filecd453692790.o] Error 1
which doesn't make any sense, because C:\Users\jonathon\AppData\Roaming\jamovi\modules\learn\R\StanHeaders\include\src\stan\model
contains model_header.hpp
, and -I"C:/Users/jonathon/AppData/Roaming/jamovi/modules/learn/R/StanHeaders/include/src/"
is clearly specified as an argument.
any ideas as to what the issue could be?
with thanks
I agree it doesn't make sense. Can you try R CMD SHLIB filecd453692790.cpp
after creating a Makevars.win file in the same directory that just contains
LOCAL_CPPFLAGS = -v -H
in order for it to be verbose about what includes it is trying to do.
ah! i figured it out. it turns out the error in compilation was a red herring. it looks like an older Rtools was being used. once i updated that, it would compile fine from the terminal.
it turns out the issue was that C:\Windows\System32
was not on the path, and when R invokes the compiler, it begins by calling cmd.exe
. it's unsual that being unable to execute the compiler because cmd.exe
is missing, fails silently.
Sorry, I didn't help anything.
Although I don't understand what you are talking about at all, it seems that the problem is solved. Pay tribute to the two developers. thank you very much
Jinghao
hello
Summary:
Wrong when calling rstan with Jamovi
Description:
I am trying to develop jamavi's modules with rstan. But when I used the module in jamovi, I got an error:
Screenshot
I tried to ask the developer of jamovi, but the developer of jamovi did not find the reason why stan throws this error. So I would like to ask the developer of stan how to solve this error.
My English is not very good, so I sent this post with Google Translate. There may be places that are difficult to understand. sorry.
Reproducible Steps:
I uploaded the jamovi module and development files to my Google Cloud. module .stan file development files
I want to reproduce this error by installing a .jmo file in jamovi.
Expected Output:
RStan Version:
packageVersion("rstan") [1] ‘2.18.1’
R Version:
R.version.string [1] "R version 3.5.1 (2018-07-02)"
Operating System:
windows10: 17134.345 Jamovi: jamovi-0.9.5.8-win64
Thank you Jinghao