# RuntimeError: OpenMC aborted unexpectedly with .plot() error

**URL:** <https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076>\
**Category:** User Support\
**Created:** [March 21, 2024, 4:00am UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076 "2024-03-21T04:00:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tklemes](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@tklemes](https://openmc.discourse.group/u/tklemes)\
**Post date:** [March 21, 2024, 4:00am UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076/1 "2024-03-21T04:00:52Z")

</div>

I’m trying to run and plot the example for the SFR, I altered it a bit. but I’m having trouble running the .plot() function specifically for

main\_in\_u.plot(origin = (0,0,0), pixels=(500, 500), width = (30.,30.), color\_by = ‘material’)

main\_out\_u.plot(origin = (0,0,0), pixels=(500, 500), width = (30.,30.), color\_by = ‘material’)

main\_u.plot(origin = (0,0,0), pixels=(1000, 1000), width = (660.,660.), color\_by = ‘material’)

but I get the error code:

Traceback (most recent call last):  
File “/_ **/Library/CloudStorage/OneDrive-** _/openMC - code research/openMC/SFR - openmc copy.py”, line 140, in   
main\_in\_u.plot(origin= (0,0,0), pixels=(500,500), width=(30,30), color\_by=‘material’)  
File “/_**/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/universe.py", line 446, in plot  
model.plot\_geometry(False, cwd=tmpdir, openmc\_exec=openmc\_exec)  
File "/**_/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/model/model.py”, line 828, in plot\_geometry  
openmc.plot\_geometry(output=output, openmc\_exec=openmc\_exec)  
File “/_**/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py", line 154, in plot\_geometry  
\_run(args, output, cwd)  
File "/**_/anaconda3/envs/openmc-env/lib/python3.12/site-packages/openmc/executor.py”, line 125, in \_run  
raise RuntimeError(error\_msg)  
RuntimeError: OpenMC aborted unexpectedly.

Process finished with exit code 1

Then, trying to fix the problem, I did:

geom\_main\_in = openmc.Geometry(main\_in\_u)

# Export the geometry to XML

geom\_main\_in.export\_to\_xml()

# Plot the geometry

openmc.plot\_geometry()

but I got the same error code.

If I comment out these three plots, I am able to run the code fully through and get k values.

please help!! I have uploaded by code below.

[SFR - openmc copy.py](https://openmc.discourse.group/uploads/short-url/3fT13DdzVmtzart90i90NuFvgR.py) (8.7 KB)

---

<div class="post-metadata">

**Author:** ![Peshwah\_Rafi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/peshwah_rafi/32/3236_2.png) [@Peshwah\_Rafi](https://openmc.discourse.group/u/Peshwah_Rafi)\
**Post date:** [March 27, 2024, 5:14pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076/2 "2024-03-27T17:14:01Z")

</div>

Could you come up with a solution?? Please let me know. I’m facing the same issue.

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/e/e7b4fb9a6626df88f8a36a70bfc3a7751e364dae.jpeg)

---

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [March 27, 2024, 8:48pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076/3 "2024-03-27T20:48:16Z")

</div>

I’m not sure if this will solve the error as the error message doesn’t give much info, but perhaps it is worth trying to install libpng. You can see libpng is mentioned in the optional section of the install docs.

[https://docs.openmc.org/en/stable/usersguide/install.html](https://docs.openmc.org/en/stable/usersguide/install.html)

---

<div class="post-metadata">

**Author:** ![tklemes](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@tklemes](https://openmc.discourse.group/u/tklemes)\
**Post date:** [March 29, 2024, 8:29pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly-with-plot-error/4076/4 "2024-03-29T20:29:45Z")

</div>

I tired installing libpng using " sudo apt install libpng-dev " but I got this error  
The operation couldn’t be completed. Unable to locate a Java Runtime.

Please visit [http://www.java.com](http://www.java.com) for information on installing Java.

I figured it was because I am using conda, so I activated the environment : openmc-env and implemented pip install libpng , where it said I already had it installed.

I jsut tried running the code again, and I got the same error again (the same one that Peshwah\_Rafi has)
