# DataError:Cross sections were not specified

**URL:** <https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465>\
**Category:** User Support\
**Created:** [November 10, 2022, 1:23pm UTC](https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465 "2022-11-10T13:23:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@Zhang](https://openmc.discourse.group/u/Zhang)\
**Post date:** [November 10, 2022, 1:23pm UTC](https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465/1 "2022-11-10T13:23:08Z")

</div>

Hello,  
I am new in OpenMC and need some help.  
First of all, I successfully downloaded openmc from source, and set up OPENMC\_CROSS\_SECTIONS environment variable in bashrc file.  
However,when I runned the “examples/pincell\_depletion/run\_depletion.py” on Ubuntu, an error occured:  
"Cross sections were not specified in Model.materials and "  
openmc.exceptions.DataError: Cross sections were not specified in Model.materials and openmc.config[‘cross\_sections’] is not set.

I hope you can help me !

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [November 15, 2022, 3:26pm UTC](https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465/2 "2022-11-15T15:26:43Z")

</div>

Hi @Zhang! Welcome to the forum!

Sorry to hear you’re having trouble with the depletion run. Does a normal run of OpenMC work for you? The one in `examples/pincell/`, say?

---

<div class="post-metadata">

**Author:** ![Choclocklate](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@Choclocklate](https://openmc.discourse.group/u/Choclocklate)\
**Post date:** [November 20, 2022, 5:28pm UTC](https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465/3 "2022-11-20T17:28:19Z")

</div>

Hello,

I have the very same problem as @Zhang, I downloaded OpenMC from source and add the OPENMC\_CROSS\_SECTIONS=/home/user/openmc/data/cross\_sections.xml line in my .bashrc.  
i have the same problem with the run\_depletion.py on Ubuntu so i tried your answer to see if it could help me too.  
i got teh followwing error messages:  
Traceback (most recent call last):  
File “plot\_spectrum.py”, line 6, in   
with openmc.StatePoint(‘statepoint.100.h5’) as sp:  
File “/home/choclocklate/.local/lib/python3.8/site-packages/openmc/statepoint.py”, line 127, in **init**  
self.\_f = h5py.File(filename, ‘r’)  
File “/home/choclocklate/.local/lib/python3.8/site-packages/h5py/\_hl/files.py”, line 533, in **init**  
fid = make\_fid(name, mode, userblock\_size, fapl, fcpl, swmr=swmr)  
File “/home/choclocklate/.local/lib/python3.8/site-packages/h5py/\_hl/files.py”, line 226, in make\_fid  
fid = h5f.open(name, flags, fapl=fapl)  
File “h5py/\_objects.pyx”, line 54, in h5py.\_objects.with\_phil.wrapper  
File “h5py/\_objects.pyx”, line 55, in h5py.\_objects.with\_phil.wrapper  
File “h5py/h5f.pyx”, line 106, in h5py.h5f.open  
FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = ‘statepoint.100.h5’, errno = 2, error message = ‘No such file or directory’, flags = 0, o\_flags = 0)

I could add taht for the depletion problem i tried another solution that was suggested here [How to indicate cross section data - #15 by neonnuke](https://openmc.discourse.group/t/how-to-indicate-cross-section-data/489/15) . But it didn’t help either =, python still retrun the same error “openmc.exceptions.DataError: Cross sections were not specified in Model.materials and openmc.config[‘cross\_sections’] is not set.”.

i hope you can help me.  
(a little bit of precision, i’m new to the Ubuntu environnement).  
Best regards

---

<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:** [November 22, 2022, 3:27pm UTC](https://openmc.discourse.group/t/dataerror-cross-sections-were-not-specified/2465/4 "2022-11-22T15:27:08Z")

</div>

You can set the cross section source by setting `openmc.config['cross_sections']` as the error message suggests:

```python
import openmc

openmc.config['cross_sections'] = '/path/to/cross_sections.xml'
...

```

This should hopefully fix the `DataError` that you’re running into. More info on configuring data sources can be found in the [user’s guide](https://docs.openmc.org/en/latest/usersguide/data.html).
