stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
140 stars 44 forks source link

New stan error in R version 4.3.3 #1431

Closed XuezhongCHEN closed 3 months ago

XuezhongCHEN commented 3 months ago

was testing famous "schools_data" and model in R. got message as below, as was asked set a new case here.

.Last.error <system_command_status_error/rlib_error_3_0/rlib_error/error> Error in (function (command = NULL, args = character(), error_on_status = TRUE, …: ! System command 'stanc.exe' failed

Exit status: 2 Stderr (last 10 lines, see $stderr for more): Called from MenhirLib.Engine.Make.lexer_lexbuf_to_supplier in file "lib/pack/menhirLib.ml", line 1668, characters 18-30 Called from MenhirLib.Engine.Make.loop_handle in file "lib/pack/menhirLib.ml", line 1725, characters 21-27 Called from FrontendParse.parse in file "src/frontend/Parse.ml", line 53, characters 6-90 Called from DuneexeStanc.get_ast_or_exit in file "src/stanc/stanc.ml", line 242, characters 9-61 Called from DuneexeStanc.use_file in file "src/stanc/stanc.ml", line 283, characters 4-148 Called from CommonICE.with_exn_message in file "src/common/ICE.ml", line 14, characters 9-15

This should never happen. Please file a bug at https://github.com/stan-dev/stanc3/issues/new and include this message and the model that caused this issue.

Backtrace:

  1. rethinking::stan(file = "schools.stan", data = schools_data, chains = 4, …
  2. rethinking::cstan(...)
  3. mod$sample(data = data, chains = chains, parallel_chains = cores, …
  4. self$variables()
  5. cmdstanr:::model_variables(stan_file = self$stan_file(), include_paths = self$include_paths(), …
  6. cmdstanr:::wsl_compatible_run(command = stanc_cmd(), args = c(wsl_safe_path(stan_file), …
  7. base::do.call(processx::run, run_args)
  8. (function (command = NULL, args = character(), error_on_status = TRUE, …
  9. processx:::throw(new_process_error(res, call = sys.call(), echo = echo, …
XuezhongCHEN commented 3 months ago

early was worked with R-studio version before 2024.04.2. after upgraded R-studio to 2024.04.2. then comes these error messages. not sure if these were due to R-studio version change. many thanks!

WardBrian commented 3 months ago

Can you share the full $stderr?

XuezhongCHEN commented 3 months ago

Sorry, just closed R-Studio

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Brian Ward @.> Sent: Thursday, June 20, 2024 8:19:45 PM To: stan-dev/stanc3 @.> Cc: XuezhongCHEN @.>; Author @.> Subject: Re: [stan-dev/stanc3] New stan error in R version 4.3.3 (Issue #1431)

Can you share the full $stderr?

— Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/stanc3/issues/1431#issuecomment-2181274954, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOJZGLQDQ7TPOEDMCYJAECLZIMMMDAVCNFSM6AAAAABJUOX5QWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRGI3TIOJVGQ. You are receiving this because you authored the thread.Message ID: @.***>

WardBrian commented 3 months ago

Ok. And this was an unedited version of 8schools?

@andrjohns have you seen something like this?

XuezhongCHEN commented 3 months ago

Hi

FYI, just as said 8 schools , the codes below were early copied from Rstan test page.

schools_data <- 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", # Stan program data = schools_data, # named list of data chains = 4, # number of Markov chains warmup = 1000, # number of warmup iterations per chain iter = 2000, # total number of iterations per chain cores = 1, # number of cores (could use one per chain) refresh= 0 # no progress shown )

print(fit) plot(fit)

Thanks a lot in advance.

Best

Snow


From: Brian Ward @.> Sent: Thursday, 20 June 2024 20:26 To: stan-dev/stanc3 @.> Cc: XuezhongCHEN @.>; Author @.> Subject: Re: [stan-dev/stanc3] New stan error in R version 4.3.3 (Issue #1431)

Ok. And this was an unedited version of 8schools?

@andrjohnshttps://github.com/andrjohns have you seen something like this?

— Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/stanc3/issues/1431#issuecomment-2181287504, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOJZGLRRMGOUHCCMEQWGFCLZIMNERAVCNFSM6AAAAABJUOX5QWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRGI4DONJQGQ. You are receiving this because you authored the thread.

WardBrian commented 3 months ago

Hi -

If you run the code again, do you get the same error? If so, please share the full $stdout

XuezhongCHEN commented 3 months ago

Hi

Thanks for your time on that. I might raised a false alarm due to using a brand new PC. While other of my PC works fine with default R WD in "C:/../Documents". But my new PC (not sure if MS/or AI function) does not directly target in local C-document directory, but always searching "schools.stan" data in my MS "One drive/Documents" and, BTW, always had error as "error: cmdstan path has not been set yet. see ?". This was the main reason I found last night. After I explicitly set WD into loval C-drive-my-document directory. It seems all problems solved. Sorry for the false alarm raised. Hope no other user having the stupid errors as I had.

Cheers Snow


From: Brian Ward @.> Sent: Friday, June 21, 2024 00:42 To: stan-dev/stanc3 @.> Cc: XuezhongCHEN @.>; Author @.> Subject: Re: [stan-dev/stanc3] New stan error in R version 4.3.3 (Issue #1431)

Hi -

If you run the code again, do you get the same error? If so, please share the full $stdout

— Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/stanc3/issues/1431#issuecomment-2181666598, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOJZGLSVREH6MTBLRACGTSTZINLGPAVCNFSM6AAAAABJUOX5QWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRGY3DMNJZHA. You are receiving this because you authored the thread.