# Linking TPythia8 with root

**URL:** <https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736>\
**Category:** Newbie\
**Created:** [February 22, 2023, 4:09pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736 "2023-02-22T16:09:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mango](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@Mango](https://root-forum.cern.ch/u/Mango)\
**Post date:** [February 22, 2023, 4:09pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/1 "2023-02-22T16:09:46Z")

</div>

Hi all! I am trying to test out the root tutorial: pythiaExample.C using TPythia8.h instead of TPythia6.h. When I try to load and execute in root prompt it returns:

/path/to/pythia8.C:2:10 fatal error: ‘TPythia8.h’ file not found.

I copied the header to /root-6.26.10-install/include/TPythia8.h  
and get a similar error:  
/path/to/root-6.26.10-install/include/TPythia8.h:9:10 fatal error: ‘Pythia8/Pythia.h’ file not found.

Seems like I need to add the standalone pythia header to root’s compile path?

Thanks in advance!

_ROOT Version:_ 6.26.10  
_Platform:_ Ubuntu 22  
_Compiler:_ g++

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 22, 2023, 5:11pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/2 "2023-02-22T17:11:20Z")

</div>

Check if: `root-config --has-pythia8`

---

<div class="post-metadata">

**Author:** ![Mango](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@Mango](https://root-forum.cern.ch/u/Mango)\
**Post date:** [February 23, 2023, 3:36pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/3 "2023-02-23T15:36:31Z")

</div>

It returned a flat ‘no’. Can you advise me on how to fix this?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 23, 2023, 9:33pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/4 "2023-02-23T21:33:52Z")

</div>

You need to [build ROOT from source](https://root.cern/install/build_from_source/) or you can try the [conda package](https://root.cern/install/#conda) (which possibly provides it).

---

<div class="post-metadata">

**Author:** ![Mango](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@Mango](https://root-forum.cern.ch/u/Mango)\
**Post date:** [February 24, 2023, 9:00pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/5 "2023-02-24T21:00:29Z")

</div>

Hi, I rebuilt ROOT from source using the instructions in the link you provided. I am still getting the same error and` root-config --has-pythia8` is still returning a flat no.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 24, 2023, 9:17pm UTC](https://root-forum.cern.ch/t/linking-tpythia8-with-root/53736/6 "2023-02-24T21:17:05Z")

</div>

Maybe you need something like this:  
`cmake -Dpythia8=ON -DPYTHIA8_DIR=/path/to/Pythia8/installation /path/to/ROOT/source`
