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

Matplotlib Calls in MultiProcess/Threads #131

Open
SorooshMani-NOAA opened this issue Jan 17, 2024 · 0 comments
Open

Matplotlib Calls in MultiProcess/Threads #131

SorooshMani-NOAA opened this issue Jan 17, 2024 · 0 comments
Assignees

Comments

@SorooshMani-NOAA
Copy link
Collaborator

ocsmesh uses matplotlib for contour level calculations. These operations are usually done in parallel and using multi processing and multi threading. This can cause issues due to interactive backends of matplotlib. We cannot blindly set agg backend to resolve this, because ocsmesh has plotting methods as well.

The current solution is for the user to force non-interactive backend in the sections of the client code which doesn't need interactive backend (and no actual plots are created). This is done by matplotlib.use('agg').

The issue that might arise in case backend is interactive is:

Exception ignored in: <function Image.__del__ at 0x7f745970cdc0>
Traceback (most recent call last):
  File "/home/smani/miniconda3/envs/meshdev/lib/python3.10/tkinter/__init__.py", line 4056, in __del__
    self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
...
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

1 participant