peclayson / ERA_Toolbox

Matlab toolbox for obtaining dependability estimates for ERP measurements
6 stars 1 forks source link

"Having a problem getting stan version. This is likely a problem with Java running out of file descriptors" after clicking "analyse" #25

Closed NeilwBailey closed 3 years ago

NeilwBailey commented 3 years ago

Dear Peter

Thank you for the making this toolbox available - it looks really interesting and I'm excited to try it out! Unfortunately I'm getting the issue listed in the title after installing the toolbox and dependencies and loading the toolbox with era_start. I've just been trying out the toolbox using simple data - a list of participants in column 1 and their Pe amplitudes in column 2 (in long format, loaded from a xlsx file).

I've pasted the full error message below in case it helps. I've also noted two points that I worked out to help me install the package, which differed slightly from the instructions, in case this might help others trying to install the packages.

Preparing data for analysis...

Model is being run in cmdstan

This may take a while depending on the amount of data 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 era_computerel (line 477) fit = stan('model_code', stan_in,...

Error in era_computerelwrap (line 187) REL = era_computerel('data',era_data.proc.data,...

Error in era_startproc>era_exec (line 1570) era_data = era_computerelwrap('era_prefs',era_prefs,'era_data',era_data);

Error while evaluating DestroyedObject Callback.

Kind regards,

Neil Bailey

peclayson commented 3 years ago

Hi Neil! Happy to help.

I'm assuming that you're running a Windows OS. Windows has been causing a lot of problems lately. Can you try this solution to installing the software? I haven't heard back from anyone about whether this solution works. I was able to use it on a Windows machine and got the toolbox to run.

Let me know how it goes and if you have any questions. Good luck!

Peter

NeilwBailey commented 3 years ago

Hi Peter

Thank you for the suggestion. I tried the suggested solution, and it seems to work well up until the point where it automatically builds cmdstan, at which point it encounters the following error:

Warning: automatic installation has only been tested using Windows 7 Command line tools installed CmdStan needs to be installed and built MatlabProcessManager is installed MatlabStan is installed CmdStan succesfully installed curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc --retry 5 --retry-delay 10 g++ -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp g++ -c -fvisibility=hidden -o bin/cmdstan/print.o src/cmdstan/print.cpp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0src/cmdstan/stansummary.cpp:1:10: fatal error: cmdstan/stansummary_helper.hpp: No such file or directory

include <cmdstan/stansummary_helper.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. make: [make/command:4: bin/cmdstan/stansummary.o] Error 1 make: Waiting for unfinished jobs.... src/cmdstan/print.cpp:1:10: fatal error: cmdstan/print_helper.hpp: No such file or directory

include <cmdstan/print_helper.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. make: *** [make/command:4: bin/cmdstan/print.o] Error 1

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 621 100 621 0 0 621 0 0:00:01 --:--:-- 0:00:01 1324

11 20.4M 11 2401k 0 0 2401k 0 0:00:08 0:00:01 0:00:07 2401k 36 20.4M 36 7697k 0 0 3848k 0 0:00:05 0:00:02 0:00:03 5296k 62 20.4M 62 12.7M 0 0 4368k 0 0:00:04 0:00:03 0:00:01 5352k 84 20.4M 84 17.2M 0 0 4428k 0 0:00:04 0:00:04 --:--:-- 5104k 100 20.4M 100 20.4M 0 0 5246k 0 0:00:04 0:00:04 --:--:-- 5083k Error using era_installdependents>era_windepsinstall (line 832) WARNING: Automatic build of CmdStan failed

Please install CmdStan manually For installation instructions, see Appendix A of the User Manual

Error in era_installdependents (line 229) era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;

Error while evaluating DestroyedObject Callback.

I've not been able to manually build cmdstan from the Rstudio version either unfortunately (the suggested method using mingw32-make doesn't seem to work for the Rstudio version).

Kind regards,

Neil

On Thu, Apr 29, 2021 at 7:28 AM Peter @.***> wrote:

Hi Neil! Happy to help.

I'm assuming that you're running a Windows OS. Windows has been causing a lot of problems lately. Can you try this solution https://github.com/peclayson/ERA_Toolbox/issues/24#issuecomment-802244274 to installing the software? I haven't heard back from anyone about whether this solution works. I was able to use it on a Windows machine and got the toolbox to run.

Let me know how it goes and if you have any questions. Good luck!

Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-828791706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAEHYTB7JK5Y53EQUS3TLB4XLANCNFSM43XCRBBA .

peclayson commented 3 years ago

Hm, whether you do the cmdstanr installation in R or within the RStudio shell shouldn't make a difference. The ERA Toolbox cannot install cmdstan on Windows (yet, hopefully I can fix this over the summer once the semester ends in a few weeks), so the only hope is install cmdstanr through R/RStudio first. What problems are you encountering when installing cmdstanr?

Peter

NeilwBailey commented 3 years ago

Hi Peter

Sorry I wasn't very clear - I can install cmdstanr through Rstudio fine (and end up with cmdstanr in the following folder: C:\Users\Neil\Documents\R\win-library\4.0\cmdstanr).

However, I can't seem to use mingw32-make in the cmd window to build cmdstanr after it's installed (to get around the error that matlab is having when trying to build cmd in the ERA toolbox). When I try, I get a message saying "No rule to make target 'build'. Stop."

Kind regards,

Neil

On Thu, Apr 29, 2021 at 7:51 PM Peter @.***> wrote:

Hm, whether you do the cmdstanr installation in R or within the RStudio shell shouldn't make a difference. The ERA Toolbox cannot install cmdstan on Windows (yet, hopefully I can fix this over the summer once the semester ends in a few weeks), so the only hope is install cmdstanr through R/RStudio first. What problems are you encountering when installing cmdstanr?

Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829095587, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAG4S77X3BGOLF5CZKLTLETYZANCNFSM43XCRBBA .

peclayson commented 3 years ago

Hi Neil,

Ah, I understand. Okay, can you try a few things in R to make sure that cmdstan is correctly built?

Can you run...

And paste the outputs of each here?

Can you also verify that you are using Windows 10 (I assume you are) and that none of your paths to the cmdstan directory have any spaces?

Sorry for the headache :) I hope we can get this sorted out. Windows has been causing a lot of issues lately...

Thanks, Peter

NeilwBailey commented 3 years ago

Hi Peter

I'm getting the following error in R when I try the commands you've listed:

Error: Other C++ toolchains installed on your system conflict with RTools. Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

I've been trying to google a solution, but can't see one unfortunately. I think I saw something about potential conflicts with python / anaconda (which I also have installed). Not sure if that would be the issue though. I actually tried to install cmdstan again with the code install_cmdstan, but it popped up the same error (which didn't happen previously when I successfully installed it).

I am using Windows 10, and my paths to cmdstan do not have any spaces (C:\Users\Neil\Documents\R\win-library\4.0\cmdstanr).

Kind regards,

Neil

On Thu, Apr 29, 2021 at 8:57 PM Peter @.***> wrote:

Hi Neil,

Ah, I understand. Okay, can you try a few things in R to make sure that cmdstan is correctly built?

Can you run...

  • cmdstanr::check_cmdstan_toolchain()
  • cmdstanr::cmdstan_version()
  • fit <- cmdstanr::cmdstanr_example("logistic", quiet = FALSE)
  • Sys.getenv("PATH")

And paste the outputs of each here?

Can you also verify that you are using Windows 10 (I assume you are) and that none of your paths to the cmdstan directory have any spaces?

Sorry for the headache :) I hope we can get this sorted out. Windows has been causing a lot of issues lately...

Thanks, Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829133699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZABEZSW7A3BCF2WNZSLTLE3P5ANCNFSM43XCRBBA .

peclayson commented 3 years ago

Thanks for the quick reply. Try this.

Can you post the output?

If it fails again, try this: install_cmdstan(check_toolchain = FALSE)

Let me know how it goes :)

Peter

peclayson commented 3 years ago

Oh, and this is the best place to go to look for solutions to cmdstanr installation issues: https://discourse.mc-stan.org/

Peter

NeilwBailey commented 3 years ago

Hi Peter

install_cmdstan(check_toolchain = FALSE) seemed to work, and installed cmdstan (although it did output a few error messages: INFO: Could not find files for the given pattern(s), despite saying * Finished installing CmdStan to C:\Users\Neil\Documents/.cmdstanr/cmdstan-2.26.1).

After that, the following codes produced the outputs I've pasted below them:

cmdstanr::cmdstan_version() [1] "2.26.1"

The same error I mentioned earlier is still showing up for some functions:

check_cmdstan_toolchain(fix = TRUE, quiet = FALSE) Installing mingw32-make and writing RTools path to ~/.Renviron ... Error: Other C++ toolchains installed on your system conflict with RTools. Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

cmdstanr::check_cmdstan_toolchain() Error: Other C++ toolchains installed on your system conflict with RTools. Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

But cmdstan seems to work to run the MCMC analyses in Rstudio:

fit <- cmdstanr::cmdstanr_example("logistic", quiet = FALSE) Compiling Stan program... Running MCMC with 4 sequential chains... Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup) Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup) ... Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling) Chain 4 Iteration: 2000 / 2000 [100%] (Sampling) Chain 4 finished in 0.4 seconds.

All 4 chains finished successfully. Mean chain execution time: 0.4 seconds. Total execution time: 2.6 seconds.

Sys.getenv("PATH") [1] "C:/Users/Neil/Documents/.cmdstanr/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\Program Files\R\R-4.0.4\bin\x64;C:\Rtools\bin;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.4.311\windows\mpi\intel64\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\compiler;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2018b\bin;C:\Program Files\MATLAB\MATLAB Runtime\v85\runtime\win64;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\MATLAB\MATLAB Runtime\v92\runtime\win64;C:\Program Files\Calibre2\;C:\Program Files\MATLAB\MATLAB Runtime\v95\runtime\win64;D:\Data Analysis\Analysis Tools and Software\GITHUB\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.1\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\mkl;C:\rtools40\mingw64\bin;C:\Users\Neil\AppData\Local\Microsoft\WindowsApps;C:\rtools40;C:\rtools40\usr\bin;"

After this, I tried to load the ERA toolbox in matlab, and it still produced the same error as previously when trying to build cmdstan unfortunately:

Error using era_installdependents>era_windepsinstall (line 832) WARNING: Automatic build of CmdStan failed

Kind regards,

Neil

On Thu, Apr 29, 2021 at 9:44 PM Peter @.***> wrote:

Oh, and this is the best place to go to look for solutions to cmdstanr installation issues: https://discourse.mc-stan.org/

Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829160105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAHQFMZBAMESQLX3ETDTLFBDVANCNFSM43XCRBBA .

peclayson commented 3 years ago

Can you now make sure that you have all of the windows paths in the environment set correctly? See here.

It looks like C:\\rtools40 C:\\rtools40\\usr\\bin

Are at the bottom of your PATH environment, but they should be at the top.

Also, have you added the new path to the cmdstan installation to your MATLAB path? See here if you need help setting MATLAB's path permanently.

Thanks, Peter

NeilwBailey commented 3 years ago

Hi Peter

Thanks for the help. I've moved those paths to the top of my environment, and have added cmdstan installation's path to matlab.

It definitely looks like I'm making progress. Starting up the ERA toolbox no longer gives me a message saying it needs to update or install dependencies. However, when I go to process data I get the following message:

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

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

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

Error in era_computerel (line 477) fit = stan('model_code', stan_in,...

Error in era_computerelwrap (line 187) REL = era_computerel('data',era_data.proc.data,...

Error in era_startproc>era_exec (line 1570) era_data = era_computerelwrap('era_prefs',era_prefs,'era_data',era_data);

Error while evaluating DestroyedObject Callback.

Thanks again for your help so far.

Kind regards,

Neil

On Thu, Apr 29, 2021 at 10:52 PM Peter @.***> wrote:

Can you now make sure that you have all of the windows paths in the environment set correctly? See here https://www.maxmantei.com/2020/05/16/cmdstanr-windows/#r-4.0-and-rtools-4.0 .

It looks like C:\rtools40 C:\rtools40\usr\bin

Are at the bottom of your PATH environment, but they should be at the top.

Also, have you added the new path to the cmdstan installation to your MATLAB path? See here https://www.mathworks.com/matlabcentral/answers/116177-how-to-add-a-folder-permanently-to-matlab-path if you need help setting MATLAB's path permanently.

Thanks, Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829211988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAG2OALBSWOMWKQ4PF3TLFJA3ANCNFSM43XCRBBA .

peclayson commented 3 years ago

Progress! I think we're close.

As part of the installation of the dependents, two packages in addition to cmdstan are installed. One of them is MatlabStan, which should be in the directory where you selected to have the dependents downloaded. Open the stan_home.m file in MatlabStan/+mstan/.

On line 8, you should see

d = 'C:\Users\brian\Downloads\cmdstan';

Change the path stored in d to the location of your cmdstan installation. I'm guessing the path is the following based on what you posted above. (I could be wrong though)

d = 'C:\Users\Neil\Documents/.cmdstanr/cmdstan-2.26.1';

Try to run your model again, and let me know how it goes.

Good luck, Peter

NeilwBailey commented 3 years ago

Hi Peter

Unfortunately changing the path in stan_home.m didn't help. Although it did change the error message, I still received an error message when I tried to process the data:

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

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

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

Error in era_computerel (line 477) fit = stan('model_code', stan_in,...

Error in era_computerelwrap (line 187) REL = era_computerel('data',era_data.proc.data,...

Error in era_startproc>era_exec (line 1570) era_data = era_computerelwrap('era_prefs',era_prefs,'era_data',era_data);

Error while evaluating DestroyedObject Callback.

Kind regards,

Neil

On Fri, Apr 30, 2021 at 1:24 AM Peter @.***> wrote:

Progress! I think we're close.

As part of the installation of the dependents, two packages in addition to cmdstan are installed. One of them is MatlabStan, which should be in the directory where you selected to have the dependents downloaded. Open the stan_home.m file in MatlabStan/+mstan/.

On line 8, you should see

d = 'C:\Users\brian\Downloads\cmdstan';

Change the path stored in d to the location of your cmdstan installation. I'm guessing the path is the following based on what you posted above. (I could be wrong though)

d = 'C:\Users\Neil\Documents/.cmdstanr/cmdstan-2.26.1';

Try to run your model again, and let me know how it goes.

Good luck, Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829332911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAC3LYQJSYDILJFNOIDTLF23JANCNFSM43XCRBBA .

peclayson commented 3 years ago

I looked at the StanModel.m code that produced the error. I believe the issue is the path to cmdstan (it's failing to make a directory). MATLAB uses the OS system defaults for paths, so the switching back and forth between / and \ in the same path might be upsetting confusing MATLAB.

Try installing cmdstanr again using the following (make sure you've installed the devtools)... library(cmdstanr) install_cmdstan(dir = 'C:\Users\Neil\Documents', check_toolchain = FALSE)

Put cmdstan somewhere sensible (no spaces in the paths). I just put the dir in there as an example. Once cmdstan has installed, update the MATLAB path and the path in the stan_home.m file. Then, try the ERA Toolbox again. (fingers crossed)

Peter

NeilwBailey commented 3 years ago

Hi Peter

Unfortunately I get another error when trying to install cmdstanr in that way - I think R has a problem with \ when used on windows machines. The following error pops up:

Error: '\U' used without hex digits in character string starting "'C:\U"

I actually checked the directory before trying to install it where you suggest, and found that there's already a cmdstan there (I suspect the ERA toolbox put it there when updating the dependencies, or maybe R built it there? I don't think I installed it there at any time).

When I tried to run the ERA toolbox with that folder specified, I get the initial error again:

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 = @.***,regexp(str{3},'.','split'));

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

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

Error in era_computerel (line 477) fit = stan('model_code', stan_in,...

Error in era_computerelwrap (line 187) REL = era_computerel('data',era_data.proc.data,...

Error in era_startproc>era_exec (line 1570) era_data = era_computerelwrap('era_prefs',era_prefs,'era_data',era_data);

Error while evaluating DestroyedObject Callback.

Kind regards,

Neil

On Fri, Apr 30, 2021 at 2:33 AM Peter @.***> wrote:

I looked at the StanModel.m code that produced the error. I believe the issue is the path to cmdstan (it's failing to make a directory). MATLAB uses the OS system defaults for paths, so the switching back and forth between / and \ in the same path might be upsetting confusing MATLAB.

Try installing cmdstanr again using the following (make sure you've installed the devtools)... library(cmdstanr) install_cmdstan(dir = 'C:\Users\Neil\Documents', check_toolchain = FALSE)

Put cmdstan somewhere sensible (no spaces in the paths). I just put the dir in there as an example. Once cmdstan has installed, update the MATLAB path and the path in the stan_home.m file. Then, try the ERA Toolbox again. (fingers crossed)

Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829399942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAAX6HMAXVQN4NGB2YLTLGC6LANCNFSM43XCRBBA .

peclayson commented 3 years ago

Whoops. Sorry about that.

You need to replace each \ with \\ so R doesn't try to escape the character following each \.

So the command might look something like this: install_cmdstan(dir = 'C:\\Users\\Neil\\Documents', check_toolchain = FALSE)

Feel free to change the path to wherever, and you can probably delete old installations of cmdstan that didn't run/build.

Good luck, Peter

NeilwBailey commented 3 years ago

Hi Peter

Unfortunately that didn't resolve the issue, I still get the java error (I also tried reversing the direction of the / in matlab, but it didn't help either).

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 = @.***,regexp(str{3},'.','split'));

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

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

Error in era_computerel (line 477) fit = stan('model_code', stan_in,...

Error in era_computerelwrap (line 187) REL = era_computerel('data',era_data.proc.data,...

Error in era_startproc>era_exec (line 1570) era_data = era_computerelwrap('era_prefs',era_prefs,'era_data',era_data);

Error while evaluating DestroyedObject Callback.

Kind regards,

Neil

On Fri, Apr 30, 2021 at 7:55 PM Peter @.***> wrote:

Whoops. Sorry about that.

You need to replace each \ with \ so R doesn't try to escape the character following each .

So the command might look something like this: install_cmdstan(dir = 'C:\Users\Neil\Documents', check_toolchain = FALSE)

Feel free to change the path to wherever, and you can probably delete old installations of cmdstan that didn't run/build.

Good luck, Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-829982689, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAFM6LL4MUMPVLQ7FUTTLJ5CRANCNFSM43XCRBBA .

peclayson commented 3 years ago

Were you able to re-install cmdstanr? All of these processes are dependent on each other, and many will overwrite your previous settings that you have "fixed". So, each time, start from scratch (i.e., delete dependents each time, verify paths each time, etc.).

Try fitting a model in cmstanr just to verify the installation worked. fit <- cmdstanr::cmdstanr_example("logistic", quiet = FALSE)

Then, verify your system path. Sys.getenv("PATH")

Make sure you update the stan_home.m file, and update your MATLAB paths.

If all of that works and looks correct, let's double check something in the ERAToolbox Windows Installation.

Open the StanModel.m file found in MatlabStan. Look for the following code around lines 841-854.

function ver = stan_version(self)
         command = [fullfile(self.stan_home,'bin','stanc') ' --version'];
         p = processManager('id','stanc version','command',command,...
                            'keepStdout',true,...
                            'printStdout',false,...
                            'pollInterval',0.005);
         p.block(0.05);
         if p.exitValue == 0
            str = regexp(p.stdout{1},'\ ','split');
            ver = '2.26.1'; %% ???What does this line say??? %%
         else
            fprintf('%s\n',p.stdout{:});
         end
      end

Check the line that I've commented with %% (ver = '2.26.1'; %% ???What does this line say??? %%).

Make sure your code says ver = '2.26.1';. If it does not after installing the ERAToolbox dependents, edit it manually.

Good luck, Peter

peclayson commented 3 years ago

I just wanted to let you know the steps I provided helped someone get the toolbox working on Windows 10.

https://github.com/peclayson/ERA_Toolbox/issues/26

I hope you got it working!

NeilwBailey commented 3 years ago

Dear Peter

Sorry about the delayed reply. It was a busy week, and I struggled for the cognitive space to think about debugging software errors.

After so much back and forth between us, I'm surprised (but also very happy and grateful) to say that your most recent suggestion worked!

The line of code that you mentioned previously specified:

ver = @.***,regexp(str{3},'.','split'));

And upon changing it to:

ver = '2.26.1'; %% ???What does this line say??? %%

The code seems to now run without any errors.

Thank you for your determination in helping me solve the issue, really appreciated. Now I just have to remind myself of how to interpret the output!

Kind regards,

Neil

On Fri, May 7, 2021 at 1:27 AM Peter @.***> wrote:

I just wanted to let you know the steps I provided helped someone get the toolbox working on Windows 10.

26 https://github.com/peclayson/ERA_Toolbox/issues/26

I hope you got it working!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/25#issuecomment-833613673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6ZAH5CQZKMMCOUSSEW6LTMKYOTANCNFSM43XCRBBA .

peclayson commented 3 years ago

Hi Neil,

Great! I’m glad we got it worked out. I’m happy to help. Hopefully upgrades will go more smoothly in the future once I rework the Windows installation.

Best of luck with your data!

Peter