Giter VIP home page Giter VIP logo

Comments (28)

brian-lau avatar brian-lau commented on June 12, 2024

Couple of quick checks:

  1. does ProcessManager work? Try running a couple of the examples here: https://github.com/brian-lau/MatlabProcessManager
  2. Do you have spaces in any of the directory names?

from matlabstan.

rplab avatar rplab commented on June 12, 2024

Hi Brian,

  1. Yes. ProcessManager works (I tried the first two examples you listed, and both are fine.)
  2. Yes! I now moved cmdstan into a folder that does not contain a space in its name, and MatlabStan runs! Thanks!

(It still gives an error with the 8 schools example, that is now:

Stan is still working. You can either:

  1. Use the peek method to get partial samples
  2. Come back later, or
  3. Attach a listener to the StanFit object.
    Attempt to reference field of non-structure array.
    Error in school_test (line 31)
    eta = fit.extract('permuted',true).eta;

But: I'm not sure if this issue is fatal, and I can think about it. (Ideas?) In any case, thanks a lot for your help!
-- Raghu

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

I suspect that the 8 schools problem is due to the extract method getting called before sampling has finished. This would happen if the entire example was evaluated all at once. See here:
https://github.com/brian-lau/MatlabStan/wiki/Blocking-the-Matlab-command-line

if you want to extract in a script.

from matlabstan.

sharnapax avatar sharnapax commented on June 12, 2024

Hi, I have the "space in path name" problem but because I am running off a second iMac HDD all paths have "Macintosh HD" in them. If I change this it will throw all sorts of things out of kilter. Is there a fix rather than just change/move?

many thanks

Rob Harrison
Sheffield UK

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

Hi Rob

I did not find a simple way to do this. If I recall correctly, I couldn't figure out a way to escape spaces in the command that gets passed through Java.

I think 'Macintosh HD' is just a link to '/', so replacing your references with '/' may solve the problem?

-b

from matlabstan.

sharnapax avatar sharnapax commented on June 12, 2024

Thanks for that Brian but it doesn;t recognise this at all (as below) - at least when I specify /Volumes/Macintosh HD/Users/ ... it gets into the try/catch section. My problem is that I boot and run apps from a SSD and have my user a/c (data etc.) on the HDD so everything needs the full path. Anyway, thanks for the prompt response - I'll keep on hacking!
Rob

Error using StanModel/set.stan_home (line 303)
Can't parse stan_home. Is it set correctly?

Error in StanModel (line 184)
self.stan_home = p.Results.stan_home;

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

from matlabstan.

gianlucaRinaldi avatar gianlucaRinaldi commented on June 12, 2024

Thanks for developing this amazing tool!
I have the same problem: cmdstan built and working (can use it with Rstan) but Matlab giving the following 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.
Output argument "ver" (and maybe others) not assigned during call to "StanModel/stan_version".

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

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

I don't have spaces in either the cmdstan install folder nor in the matlab stan folder.
Moreover my startup.m file contains the following line:
addpath C:\Users\grinaldi\Documents\MATLAB\stan

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

Sorry, seems the error output got suppressed?

from matlabstan.

gianlucaRinaldi avatar gianlucaRinaldi commented on June 12, 2024

Hi Brian, I've updated my post in case you didn't see!

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

I've seen this problem occasionally, and it seems to be a Java-related issue (java is used for communicating with CmdStan). You may find some clues here:

https://github.com/brian-lau/MatlabProcessManager/wiki/Potential-gotchas#process-fails-to-start

although I don't know how to change things on Windows. If it's not too troublesome, can you try after a restart?

from matlabstan.

ianthe00 avatar ianthe00 commented on June 12, 2024

Hi everyone,

I’ve tried to install and run MatlabStan (v. 2.7.0; cmdstan 2.14.0; operating system Operating System: Debian GNU/Linux 8 (jessie), Kernel: Linux 3.16.0-4-amd64)

After adding cmstan and ProcesManager (in addition to MatlabStan) to the MATLAB path, I get the same error some have reported before when testing the simple "eight schools" code:

??? Error using ==> StanModel>StanModel.set.stan_home at 311
Does not look like a proper stan setup

Note: ProcessManager runs properly (tested exampleListener & exitHandler(src,data))

Note 2: I edited stan_home.m in +mstan to include the proper directory

d='/home/myusername/eeg/matlab/bayesian/Stan/cmdstan';

Thanks for any advice!

ianthe00

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

Hi,

Can you confirm that running the CmdStan example from the user's guide runs outside of matlab (ie, at the command line)?

-b

from matlabstan.

ianthe00 avatar ianthe00 commented on June 12, 2024

Hi Brian,

thanks for the quick reply. I proceeded today to follow the cmdstan tutorial (Building cmdstan, compiling and executing a program etc) and it works fine from the command line.

After doing that, I tried again to use stan within MATLAB and now it finds the proper stan setup.
I have however other issues now (with the version of GLIBCXX in libstdc++.so.6) but I can solve this hopefully by using my other linux machine with the current 2016 MATLAB version.

Thanks for your help. So I guess that the issue was that I had not yet properly configured cmdstan from the command line (using make -j4 and so on)? Do you think it would be possible to explicitly mention this requirement here?

https://github.com/brian-lau/MatlabStan/wiki/Getting-Started

Thanks again

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

Hi,

The wiki has been clarified. Regarding the GLIBCXX error, you may find a solution here:

https://github.com/brian-lau/MatlabStan/wiki/Solving-issues-with-GLIBCXX-and-libstdc

Thanks.

from matlabstan.

ianthe00 avatar ianthe00 commented on June 12, 2024

Thanks so much!

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

I am also having a problem getting started running Stan from Matlab. I compiled cmdstan, but when i try to run any of the examples, I get an error. I have stan_home in /MatlabStan-2.7.0.0/+mstan, and I have the directory in stan_home set to my matlab folder, which also contains cmdstan-2.14.0

I get the following error:

Error using StanModel/set.stan_home (line 311)
Does not look like a proper stan setup

Error in StanModel (line 184)
self.stan_home = p.Results.stan_home;

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

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

stan_home should be set to the path where the CmdStan is, which is where you built CmdStan, not necessarily where you put the Matlab files.

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

What version of Matlab are you using? Does the eight schools example from the readme run?

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

brian-lau avatar brian-lau commented on June 12, 2024

Are you able to run CmdStan examples outside of Matlab?

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

ericaashe avatar ericaashe commented on June 12, 2024

from matlabstan.

mfalcy avatar mfalcy commented on June 12, 2024

I'm also "Having a problem getting stan version" when trying to run the eight schools example. For whatever it's worth, processManager seems to work if I enter

p = processManager('command','nslookup www.google.com');

I'm on Windows 10 and MATLAB 2017b.

Full error readout follows.

Thanks in advance!

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 processManager/start (line 366)
Java exception occurred:
java.io.IOException: Cannot run program "C:\Stan\cmdstan-2.17.1\bin\stanc" (in directory
"N:\docs\Stan\MatlabStan-2.15.1.0"): CreateProcess error=2, The system cannot find the file specified

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

at java.lang.Runtime.exec(Runtime.java:620)

at java.lang.Runtime.exec(Runtime.java:450)

Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified

at java.lang.ProcessImpl.create(Native Method)

at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)

at java.lang.ProcessImpl.start(ProcessImpl.java:137)

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

... 2 more

Error in processManager/set.command (line 216)
self.start();
Error in processManager (line 181)
self.command = p.Results.command;
Error in StanModel/stan_version (line 843)
p = processManager('id','stanc version','command',command,...
Error in StanModel (line 196)
ver = self.stan_version();
Error in stan (line 108)
model = StanModel();

from matlabstan.

HashemiScience avatar HashemiScience commented on June 12, 2024

@mfalcy not sure if you ever solved your issue, but I was having a similar problem and none of the above solutions solved it. I managed to localize the issue to line 850 of StanModel.m. It was not appropriately extracting the stanc version, so I just hardcoded it in (ver = '2.21.0') and it works. I'm sure this can be solved much more elegantly so it isn't hard coded.

from matlabstan.

SaidehF avatar SaidehF commented on June 12, 2024

Hello,

I also have the same problem as mfalcy. I have Matlab2019a and Windows10. I did the above recommendations, but none of them work.
I really appreciate if anyone could help me to find the solution.

thanks in advance.
Saideh

from matlabstan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.