# openmc-plot-mesh-tally

**URL:** <https://openmc.discourse.group/t/openmc-plot-mesh-tally/364>\
**Category:** User Support\
**Created:** [October 18, 2018, 10:29am UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364 "2018-10-18T10:29:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 18, 2018, 10:29am UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/1 "2018-10-18T10:29:03Z")

</div>

Hello, I am trying to follow the guide here [https://openmc.readthedocs.io/en/stable/usersguide/processing.html?highlight=plot%20tallies](https://openmc.readthedocs.io/en/stable/usersguide/processing.html?highlight=plot%20tallies)

plotting in 2D.

I want to plot a mesh tally in two dimension. I am running the

## `openmc-plot-mesh-tally`

directly in my project directory. I got this below error

Sharifs-MacBook-Pro:JSA sharifabudarda$ openmc-plot-mesh-tally

/Users/sharifabudarda/miniconda3/lib/python3.6/site-packages/h5py/ **init**.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

from .\_conv import register\_converters as \_register\_converters

2018-10-18 13:27:58.800 python[5891:300094] -[NSApplication \_setup:]: unrecognized selector sent to instance 0x7f95bf05efd0

2018-10-18 13:27:58.804 python[5891:300094] \*\*\* Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[NSApplication \_setup:]: unrecognized selector sent to instance 0x7f95bf05efd0’

\*\*\* First throw call stack:

(

0 CoreFoundation 0x00007fff3bbbd571 \_\_exceptionPreprocess + 256

1 libobjc.A.dylib 0x00007fff67b6aefb objc\_exception\_throw + 48

2 CoreFoundation 0x00007fff3bc3aca5 -[NSObject(NSObject) \_\_retain\_OA] + 0

3 CoreFoundation 0x00007fff3bb5c7fe _ **forwarding** _ + 1468

4 CoreFoundation 0x00007fff3bb5c1b8 \_CF\_forwarding\_prep\_0 + 120

5 libtk8.6.dylib 0x00000001092bd46f TkpInit + 383

6 libtk8.6.dylib 0x000000010921621e Initialize + 2622

7 \_tkinter.cpython-36m-darwin.so 0x000000010903ca16 \_tkinter\_create + 1174

8 python 0x0000000107fe0b78 \_PyCFunction\_FastCallDict + 200

9 python 0x00000001080b824f call\_function + 143

10 python 0x00000001080b5f4c \_PyEval\_EvalFrameDefault + 47100

11 python 0x00000001080a9589 \_PyEval\_EvalCodeWithName + 425

12 python 0x00000001080b8e15 \_PyFunction\_FastCallDict + 373

13 python 0x0000000107f5ee80 \_PyObject\_FastCallDict + 320

14 python 0x0000000107f86468 method\_call + 136

15 python 0x0000000107f664ee PyObject\_Call + 62

16 python 0x0000000108008065 slot\_tp\_init + 117

17 python 0x000000010800c5b1 type\_call + 241

18 python 0x0000000107f5edf1 \_PyObject\_FastCallDict + 177

19 python 0x00000001080b8348 call\_function + 392

20 python 0x00000001080b5f4c \_PyEval\_EvalFrameDefault + 47100

21 python 0x00000001080a9589 \_PyEval\_EvalCodeWithName + 425

22 python 0x00000001080a3d99 builtin\_exec + 345

23 python 0x0000000107fe0b78 \_PyCFunction\_FastCallDict + 200

24 python 0x00000001080b824f call\_function + 143

25 python 0x00000001080b5f4c \_PyEval\_EvalFrameDefault + 47100

26 python 0x00000001080b85fc fast\_function + 188

27 python 0x00000001080b82ac call\_function + 236

28 python 0x00000001080b5f4c \_PyEval\_EvalFrameDefault + 47100

29 python 0x00000001080b85fc fast\_function + 188

30 python 0x00000001080b82ac call\_function + 236

31 python 0x00000001080b5f4c \_PyEval\_EvalFrameDefault + 47100

32 python 0x00000001080a9589 \_PyEval\_EvalCodeWithName + 425

33 python 0x000000010810163c PyRun\_FileExFlags + 252

34 python 0x0000000108100dee PyRun\_SimpleFileExFlags + 366

35 python 0x0000000108126dd6 Py\_Main + 3718

36 python 0x0000000107f56e7d main + 509

37 libdyld.dylib 0x00007fff68c31085 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6

What I do here? Thanks.

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 18, 2018, 1:11pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/2 "2018-10-18T13:11:20Z")

</div>

Looks like this could be a bug in openmc-plot-mesh-tally. See this [stack overflow post](https://stackoverflow.com/questions/32019556/matplotlib-crashing-tkinter-application) with a similar problem and solution. If you’re comfortable, you can try making changes in the openmc-plot-mesh-tally script, adding the following:

import matplotlib  
matplotlib.use(“TkAgg”)

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 18, 2018, 1:19pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/3 "2018-10-18T13:19:30Z")

</div>

Hello Dr, i was using mac system when i post this. In mac system this does not work and shows this error. I move into my linux system and run the same command there. It worked. In both platform i have openmc veraion 10 installed. I will follow up with your guide above. Thanks for the reply.

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 18, 2018, 10:49pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/4 "2018-10-18T22:49:44Z")

</div>

Hello, Dr, Can you share me the directory of the script file stored in? I am in mac OS X10.14. I have miniconda3 installed. I looked for the main script file I found two of the script

‎⁨MAC OS X⁩ ▸ ⁨Users⁩ ▸ ⁨xxxxx ▸ ⁨miniconda3⁩ ▸ ⁨pkgs⁩ ▸ ⁨openmc-0.10.0-0⁩ ▸ ⁨lib⁩ ▸ ⁨python3.6⁩ ▸ ⁨site-packages⁩ ▸ ⁨openmc-0.10.0-py3.6-macosx-10.9-x86\_64.egg-info⁩ ▸ ⁨scripts⁩

and another one is on

‎⁨MAC OS X⁩ ▸ ⁨Users⁩ ▸ ⁨sharifabudarda⁩ ▸ ⁨miniconda3⁩ ▸ ⁨pkgs⁩ ▸ ⁨openmc-0.10.0-py36hb8ecfd0\_2⁩ ▸ ⁨lib⁩ ▸ ⁨python3.6⁩ ▸ ⁨site-packages⁩ ▸ ⁨openmc-0.10.0-py3.6-macosx-10.9-x86\_64.egg-info⁩ ▸ ⁨scripts⁩

I tried to change in both of them as the below image shows. Please reply if I am doing right. This is only in mac OS. In linux, it works. Thanks.

 ![1.png](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/4822d99fe3d7be3c39fa38e5633884cf2d7a76d8.png)

![2.png](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/11c40ff9421bb1319197dfe2564859bc07a27218.png)

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 19, 2018, 2:51am UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/5 "2018-10-19T02:51:42Z")

</div>

I’m not too sure about the exact path on macOS, but in your case I would probably just change it in both. The change that you made looks correct to me.

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 19, 2018, 2:49pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/6 "2018-10-19T14:49:55Z")

</div>

Hello, Dr, Ok, I did update of the miniconda packages by

conda update conda

and also the openmc package by

conda update openmc

I also installed vtk package for conda and also update python package

now, if I run the openmc-plot-mesh-tally I am having a different issue. The log is below. can you guide what I can do here? Thanks.

Sharifs-MBP:JSA sharifabudarda$ openmc-plot-mesh-tally statepoint.555.h5

Traceback (most recent call last):

File “/Users/sharifabudarda/miniconda3/bin/openmc-plot-mesh-tally”, line 4, in

**import** (‘pkg\_resources’).run\_script(‘openmc==0.10.0’, ‘openmc-plot-mesh-tally’)

File “/Users/sharifabudarda/miniconda3/lib/python3.6/site-packages/pkg\_resources/ **init**.py”, line 750, in run\_script

self.require(requires)[0].run\_script(script\_name, ns)

File “/Users/sharifabudarda/miniconda3/lib/python3.6/site-packages/pkg\_resources/ **init**.py”, line 1527, in run\_script

exec(code, namespace, namespace)

File “/Users/sharifabudarda/miniconda3/lib/python3.6/site-packages/openmc-0.10.0-py3.6-macosx-10.9-x86\_64.egg-info/scripts/openmc-plot-mesh-tally”, line 15, in

from matplotlib.backends.backend\_tkagg import NavigationToolbar2TkAgg

ImportError: cannot import name ‘NavigationToolbar2TkAgg’

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 19, 2018, 3:42pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/7 "2018-10-19T15:42:43Z")

</div>

Hello Dr, I was able to resolve the issue. Here is what I did, In

“/Users/sharifabudarda/miniconda3/lib/python3.6/site-packages/openmc-0.10.0-py3.6-macosx-10.9-x86\_64.egg-info/scripts/openmc-plot-mesh-tally” I changed the

NavigationToolbar2TkAgg  
into  
NavigationToolbar2Tk

That does it. For me, Now I am able to run openmc-plot-mesh-tally command. Thanks for your guide.

---

<div class="post-metadata">

**Author:** ![shabudarda](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shabudarda/32/497_2.png) [@shabudarda](https://openmc.discourse.group/u/shabudarda)\
**Post date:** [October 19, 2018, 3:43pm UTC](https://openmc.discourse.group/t/openmc-plot-mesh-tally/364/8 "2018-10-19T15:43:22Z")

</div>

[https://stackoverflow.com/questions/50330320/what-to-use-instead-of-navigationtoolbar2tkagg](https://stackoverflow.com/questions/50330320/what-to-use-instead-of-navigationtoolbar2tkagg)

this link has the solution
