StanJulia / CmdStan.jl

CmdStan.jl v6 provides an alternative, older Julia wrapper to Stan's `cmdstan` executable. CmdStan will be deprecated in 2022.
MIT License
30 stars 12 forks source link

Error in v6 #82

Closed gbarz closed 3 years ago

gbarz commented 4 years ago

Trying to execute linked CmdStan in v.6.0.0 throws an error: Return code = -3

This occurs for v6.0.0 in Atom on MacOS when running the bernoulli or kid examples (or custom code)

e.g.: rc, chns, cnames = stan(stanmodel, bernoullidata, ProjDir, CmdStanDir=CMDSTAN_HOME)

(As an aside, pinning CmdStan to 5.6.0 or 5.5.0 results in Julia command execution become extremely slow, even for simple variable assignments, so I was unable to test for the existence of the error in earlier versions)

Error code details Return code = -3 error(::String) at error.jl:33 (::CmdStan.var"#12#15"{Bool,Stanmodel})() at stancode.jl:124 cd(::CmdStan.var"#12#15"{Bool,Stanmodel}, ::String) at file.jl:104

stan#10(::Type, ::Bool, ::Bool, ::String, ::Bool, ::Bool, ::typeof(stan), ::Stanmodel, ::Dict{String,Any}, ::String) at stancode.jl:104

(::CmdStan.var"#kw##stan")(::NamedTuple{(:CmdStanDir,),Tuple{String}}, ::typeof(stan), ::Stanmodel, ::Dict{String,Any}, ::String) at none:0 top-level scope at scratchpad.jl:25

goedman commented 4 years ago

Hi @gbarz

This return code means compilation of the Stan language program failed. In the bernoulli example, in de tmp directory, there are 2 files (bernoulli_make.log and bernoulli_build.log) that possibly contain an indication of what might have gone wrong.

I'm a bit surprised I don't see a message like this in Atom:

File /Users/rob/.julia/dev/CmdStan/examples/Bernoulli/tmp/bernoulli.stan will be updated.

An error occurred while compiling the Stan program.

Please check your Stan program in variable 'bernoulli' and the contents of /Users/rob/.julia/dev/CmdStan/examples/Bernoulli/tmp/bernoulli_build.log.
Note that Stan does not handle blanks in path names.
ERROR: LoadError: Return code = -3
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] (::CmdStan.var"#12#15"{Bool,Stanmodel})() at /Users/rob/.julia/packages/CmdStan/gOSrn/src/main/stancode.jl:124
...
goedman commented 4 years ago

Above error shows up if I insert an error in the Stan language program, e.g. after inserting the line test:


  bernoullimodel = "
  data { 
    test
    int<lower=1> N; 
    int<lower=0,upper=1> y[N];
  } 
  parameters {
    real<lower=0,upper=1> theta;
  } 
...
gbarz commented 4 years ago

I also tried by simply copying and running the kid example for v6 and receive the same error.

However, I will check again.

On Jan 27, 2020, at 10:32 AM, Rob J Goedman notifications@github.com wrote:

Above error shows up if I insert an error in the Stan language program, e.g. after inserting the line test:

bernoullimodel = " data { test int N; int y[N]; } parameters { real theta; } ... — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/StanJulia/CmdStan.jl/issues/82?email_source=notifications&email_token=AA2MOIFVUWC5HLRL5YTYGXDQ735BPA5CNFSM4KMCQ2L2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ75UXY#issuecomment-578804319, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2MOIEAIGUJJMGA5H7ABX3Q735BPANCNFSM4KMCQ2LQ.

goedman commented 4 years ago

Might point to a problem with Stan's cmdstan executable. Hopefully make.log or build.log give an indication.

goedman commented 4 years ago

Hi @gbarz

Let me know if you need help getting Stan's cmdstan installed.

gbarz commented 4 years ago

Rob

Thank you for the offer.

I should be okay. I must have broken something during a update as the code was working fine in an earlier version. (FYI, I had corresponded with you regarding the issue addressed by release 5.2.3 and things were okay at that time.)

Regards, Graydon

On Jan 28, 2020, at 2:59 PM, Rob J Goedman notifications@github.com wrote:

Hi @gbarz https://github.com/gbarz Let me know if you need help getting Stan's cmdstan installed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/StanJulia/CmdStan.jl/issues/82?email_source=notifications&email_token=AA2MOIEHVATDXBZZ3EMB343RACFATA5CNFSM4KMCQ2L2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKEV4HY#issuecomment-579427871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2MOICQT4V57AQRJWFFQI3RACFATANCNFSM4KMCQ2LQ.

goedman commented 4 years ago

Graydon, one other point, probably you found this out already, but just in case, cmdstan 2.21.0 and I believe cmdstan 2.20.0, do compilation in cmdstan in 2 steps. So if I update Xcode it will fail and I must rebuild cmdstan.