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

matlab runtime error #110

Open
lmn369 opened this issue Nov 12, 2024 · 10 comments
Open

matlab runtime error #110

lmn369 opened this issue Nov 12, 2024 · 10 comments

Comments

@lmn369
Copy link

lmn369 commented Nov 12, 2024

I and Mostafa were trying to initialize stemmus-scope on Linux668 using Jupyter notebook, but encountered this error.
Do you have any idea how to solve this problem?
image

@BSchilperoort
Copy link
Contributor

Do you have any idea how to solve this problem?

It seems like you're running the MATLAB process locally (not in a container). To debug this try to manually start the process from the command line, and pass the config file there. That would allow you to see the full matlab error.

See the docs here; https://ecoextreml.github.io/STEMMUS_SCOPE/run_model/#run-the-model-with-matlab-runtime

@MostafaGomaa93
Copy link
Contributor

Hi Bart, we actually tried to run the model in the terminal using ./STEMMUS_SCOPE/exe/STEMMUS_SCOPE config_file.txt and it runs successfully

图像

@lmn369
Copy link
Author

lmn369 commented Nov 12, 2024

@BSchilperoort Hi bart, we also managed to delete the cache folder, but the error is still there. Do you have any further suggestions?

@BSchilperoort
Copy link
Contributor

Hm. what if you put the code in a .py file, and execute that in the command line? Maybe there's some permission problem.

@lmn369
Copy link
Author

lmn369 commented Nov 12, 2024

@BSchilperoort Hi bart, same error using a .py file
image

@BSchilperoort
Copy link
Contributor

It seems like it cannot correctly find the cache dir, and you don't have root access so it fails.

Maybe try the following at the top of the python file

import os
os.environ['MCR_CACHE_ROOT'] = "/home/lim1/mcr_cache"

and create that folder in your home dir

@lmn369
Copy link
Author

lmn369 commented Nov 12, 2024

@BSchilperoort I created the mcr_cache folder under /home/lim1/, and added the codes at the top of the python file, still the same error
1731418080213

@BSchilperoort
Copy link
Contributor

Turns out that that environment variable is not passed in the python code;

env = {
"LD_LIBRARY_PATH": lib_path,
"MATLAB_LOG_DIR": str(config["OutputPath"]),
}
self.process = subprocess.Popen(
args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
bufsize=0,
env=env,
)

I think something might be going wrong because the subprocess using the wrong shell, which doesn't having the permissions set up, or it's only because of the environment variable.

You could try modifying the pystemmusscope code locally (making sure it's installed in editable mode or reinstalled in your environment):

        env = {
            "LD_LIBRARY_PATH": lib_path,
            "MATLAB_LOG_DIR": str(config["OutputPath"]),
            "MCR_CACHE_ROOT": os.getenv("MCR_CACHE_ROOT")
        }


        self.process = subprocess.Popen(
            args,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            bufsize=0,
            env=env,
        )

but I am not sure this will fix it.

@lmn369
Copy link
Author

lmn369 commented Nov 13, 2024

@BSchilperoort After adding this code "MCR_CACHE_ROOT": os.getenv("MCR_CACHE_ROOT"), problem solved! Thanks for your suggestion!

@lmn369 lmn369 closed this as completed Nov 13, 2024
@BSchilperoort
Copy link
Contributor

I'll reopen this issue so we can fix the code on github

@BSchilperoort BSchilperoort reopened this Nov 13, 2024
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