RuntimeError when plotting (in pincell-tutorial's universe.plot() and openmc.plot_geometry())

Dear experts,

I just started diving into openmc and experimented with the first OpenMC example (Modeling a Pin-Cell).

Everything seems to work fine until the first plots (Cell 24, universe.plot(width=(2.0, 2.0), origin=(0.0, 0.0, 0.1))) where I get:

Traceback (most recent call last):
  File "/Users/sophie/Projects/test_openmc/test_openmc_minimal.py", line 19, in <module>
    universe.plot(width=(2.0, 2.0), origin=(0.0, 0.0, 0.1))
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/universe.py", line 358, in plot
    model.plot_geometry(False, cwd=tmpdir, openmc_exec=openmc_exec)
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/model/model.py", line 705, in plot_geometry
    openmc.plot_geometry(output=output, openmc_exec=openmc_exec)
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py", line 139, in plot_geometry
    _run([openmc_exec, '-p'], output, cwd)
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py", line 118, in _run
    raise RuntimeError(error_msg)
RuntimeError: OpenMC aborted unexpectedly.

If I am removing the universe.plot(), the code runs fine and calculates the keff consistently with the example. It then, however, fails at the second plot (Cell 45, openmc.plot_geometry()) via

 =======================>     PLOTTING SUMMARY     <========================

Plot ID: 1
Plot file: pinplot.png
Universe depth: -1
Plot Type: Slice
Origin: 0 0 0
Width: 1.26 1.26
Coloring: Materials
Basis: XY
Pixels: 200 200

 Processing plot 1: pinplot.png...
libpng warning: Application built with libpng-1.4.12 but running with 1.6.39
Traceback (most recent call last):
  File "/Users/sophie/Projects/test_openmc/test_openmc_extendedminimal.py", line 110, in <module>
    openmc.plot_geometry()
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py", line 139, in plot_geometry
    _run([openmc_exec, '-p'], output, cwd)
  File "/Users/sophie/.conda/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py", line 118, in _run
    raise RuntimeError(error_msg)
RuntimeError: OpenMC aborted unexpectedly.

I am using OpenMC version 0.13.2., installed it via conda/mamba as recommended in the Quick Install Guide on my macbook running macOS Monterey (12.6.2).

Has someone seen this before or any idea what to do? Every hint is appreciated - thanks a lot!

Cheers,
Sophie

2 Likes

Dear all,

just a quick follow-up for those struggling with the same error: installing openmc from source as suggested in the Quick Install Guide worked just fine for me now. (I therefore suspect that the issue above is somehow related to the conda install, maybe in combination with using macOS).

Cheers!
Sophie

1 Like

I think OpenMC 'aborts unexpectedly' when plotting - #5 by Kladdy is a similar issue.

@sop_kretzschmar Glad to hear you were able to get around this problem! To expand on the underlying issue:

libpng warning: Application built with libpng-1.4.12 but running with 1.6.39
Traceback (most recent call last):

This tells us that the OpenMC executable was built with one version of libpng (used for plotting) but at the time it’s running, it is picking up a different version of libpng. I think this is really a problem with the conda package for OpenMC, and we probably need to update our conda-forge recipe.

1 Like

Hi @paulromano,

Is there a resolution to this issue that doesn’t involve installing openmc from source?

I am also using macOS / conda and keep getting the libpng version error while plotting:

Dear all,

just to reply once more to the plotting issue:
I got this fixed by installing openmc from source as explained here at “Installing from Source on Linux or Mac OS X”, with one small change:
I needed to change to the master branch to install openmc v0.13.3 - in the current version of the instructions, you’ll get the development branch with openmc v0.13.4.dev0 (which for me crashes currently). Maybe, if this does not create issues elsewhere, the default branch could be changed to master instead of develop?

Hope this helps!
Cheers,
Sophie

@paulromano and @pshriwise
I’ve also encountered this same issue with a recent (July 2023) install using the Conda-forge instructions. Can you please let me know if there is any other solution other than reinstalling from source, as per request above?

Thanks

I just installed the latest version of openmc (0.15.0) and I’m still having this problem, openmc is looking for libpng version 1.4.12, but the version that it is running, installed via conda/mamba, is 1.6.43