Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in checking Stan version & eight schools example #61

Open
dajagl opened this issue Apr 7, 2022 · 3 comments
Open

Error in checking Stan version & eight schools example #61

dajagl opened this issue Apr 7, 2022 · 3 comments

Comments

@dajagl
Copy link

dajagl commented Apr 7, 2022

I am using MATLAB version 9.9.0.1718557 (R2020b) Update 6 on macOS Mojave Version 10.14.6.

Going through the eight schools example in Getting Started. This is my output.

Having a problem getting stan version.
This is likely a problem with Java running out of file descriptors
Trying again.
Trying again.
Trying again.
Trying again.
Trying again.
Trying again.
Giving up.
Error using cellfun
Non-scalar in Uniform output, at index 1, output 1.
Set 'UniformOutput' to false.

Error in StanModel/stan_version (line 850)
            ver = cellfun(@str2num,regexp(str{3},'\.','split'));

Error in StanModel (line 196)
               ver = self.stan_version();

Error in stan (line 108)
   model = StanModel();

Error in testStan (line 5)
fit = stan('file', 'eight_schools.stan', 'data', schools_dat, 'iter', 1000, 'chains', 4);

Solution:
Change line 850 in StanModel.m: ver = cellfun(@str2num,regexp(str{3},'\.','split')); to ver = cellfun(@str2num,regexp(str{2}(2:end),'\.','split'));

Also, eight_schools.stan does not match what is in the example and will give an error: eta is undefined.

@AndyPohlNZ
Copy link

Thank you! I had the same issue running MATLAB version 9.12.0.1956245 (R2022a) Update 2 on Ubuntu 20.04.4. Your fix on line 850 of StanModel.m worked!

augeas pushed a commit to augeas/MatlabStan that referenced this issue Mar 28, 2023
The regex to check the Stan version will be more robust if we:
   1) *match* on the first string of numerals and dots following a "v": '(?<=v)[0-9\.]+'
   2) *split* on "." and cast the chunks to integers as before

 On branch master
 Changes to be committed:
	modified:   StanModel.m
@cyf203
Copy link

cyf203 commented Jun 6, 2023

Hey, I have the same issue running Matlab version (R2020a) on 64 bit windows 10. I did the line change in StanModel.m. I can pass the error described above. But now, I have a new error after modification of StanModel.m.

Any thoughts? Thank you!!

Having a problem getting stan version.
This is likely a problem with Java running out of file descriptors
Trying again.
Trying again.
Trying again.
Trying again.
Trying again.
Trying again.
Giving up.
Error using mstan.check_ver (line 13)
Versions should be MAJOR.MINOR.PATCH

Error in mstan.stan_params (line 14)
   if mstan.check_ver(ver,'2.1.0') % Stan 2.1+

Error in StanModel (line 197)
               [self.defaults,self.validators] = mstan.stan_params(ver);

Error in stan (line 108)
   model = StanModel();

Error in matlabstan_test (line 27)
fit = stan('model_code',schools_code,'data',schools_dat);

@cyf203
Copy link

cyf203 commented Jun 7, 2023

I've solved the problem by hard code the ver = '2.22.0'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants