# RuntimeError: No cross\_sections.xml file was specified

**URL:** <https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315>\
**Category:** User Support\
**Created:** [July 19, 2021, 3:30pm UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315 "2021-07-19T15:30:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rechardrex](https://avatars.discourse-cdn.com/v4/letter/r/5f9b8f/32.png) [@rechardrex](https://openmc.discourse.group/u/rechardrex)\
**Post date:** [July 19, 2021, 3:30pm UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315/1 "2021-07-19T15:30:19Z")

</div>

Hello,

I’m new in OpenMC and need some help.

I successfully downloaded openmc and set up OPENMC\_CROSS\_SECTION environment variable  
However, when I runed the “Modeling Hexagonal Lattices” example on Jupyter Notebook, an error occured

input

```auto
plot = openmc.Plot.from_geometry(geometry)
plot.color_by = 'material'
plot.colors = colors = {
    water: 'blue',
    fuel: 'olive',
    fuel2: 'yellow'
}
plot.to_ipython_image()

```

error message

```auto
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-53-856b8d0e4c5c> in <module>
      6 fuel2: 'yellow'
      7 }
----> 8 plot.to_ipython_image()

~/.local/lib/python3.6/site-packages/openmc/plots.py in to_ipython_image(self, openmc_exec, cwd, convert_exec)
    703 
    704 # Run OpenMC in geometry plotting mode
--> 705 openmc.plot_geometry(False, openmc_exec, cwd)
    706 
    707 # Convert to .png

~/.local/lib/python3.6/site-packages/openmc/executor.py in plot_geometry(output, openmc_exec, cwd)
     57 
     58 """
---> 59 _run([openmc_exec, '-p'], output, cwd)
     60 
     61 

~/.local/lib/python3.6/site-packages/openmc/executor.py in _run(args, output, cwd)
     36 error_msg = ' '.join(error_msg.split())
     37 
---> 38 raise RuntimeError(error_msg)
     39 
     40 

RuntimeError: No cross_sections.xml file was specified in materials.xml or in the OPENMC_CROSS_SECTIONS environment variable. OpenMC needs such a file to identify where to find data libraries. Please consult the user's guide at https://docs.openmc.org/ for information on how to set up data libraries.

```

I tried to write the address directly, but it didn’t work

materials = openmc.Materials([mat1, mat2, …])  
materials.cross\_sections = ‘/path/to/nucleardata/cross\_sections.xml’  
materials.export\_to\_xml()

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![fsabab](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/fsabab/32/1374_2.png) [@fsabab](https://openmc.discourse.group/u/fsabab)\
**Post date:** [July 20, 2021, 5:23pm UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315/2 "2021-07-20T17:23:01Z")

</div>

> [@rechardrex](#):
>
> I successfully downloaded openmc and set up OPENMC\_CROSS\_SECTION environment variable.

Edit your `~/.bashrc` file and write `OPENMC_CROSS_SECTIONS` instead of `OPENMC_CROSS_SECTION`. Save it and close your terminal. Your problem should be solved.

---

<div class="post-metadata">

**Author:** ![soha](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/soha/32/3658_2.png) [@soha](https://openmc.discourse.group/u/soha)\
**Post date:** [December 23, 2022, 1:31am UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315/3 "2022-12-23T01:31:06Z")

</div>

I’m getting the same error, but can’t find the `~/.bashrc` file you’ve mentioned… Could you elaborate a bit more?

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/a/ae0c5c882830eb28d72e9176d34945a0f283be3d.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:** [December 23, 2022, 2:01am UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315/4 "2022-12-23T02:01:21Z")

</div>

@soha On macOS, you will likely need to put it in `~/.bash_profile` instead of `~/.bashrc`. You can read more about this [here](https://apple.stackexchange.com/questions/119711/why-doesnt-mac-os-x-source-bashrc).

Also note that you don’t necessarily have to use the `OPENMC_CROSS_SECTIONS` environment variable. You can alternatively set [`openmc.config['cross_sections']`](https://docs.openmc.org/en/latest/usersguide/data.html#runtime-configuration) from your Python script.

---

<div class="post-metadata">

**Author:** ![soha](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/soha/32/3658_2.png) [@soha](https://openmc.discourse.group/u/soha)\
**Post date:** [December 23, 2022, 6:10pm UTC](https://openmc.discourse.group/t/runtimeerror-no-cross-sections-xml-file-was-specified/1315/5 "2022-12-23T18:10:01Z")

</div>

Worked! Thank you! 😄
