Running macro with Pythia8: fatal error: Pythia8/pythia.h:No such file or directory

ROOT Version: 5.34.36
Platform: Ubuntu 18.04
Compiler: Not Provided

I had post a thread about similar issues before :Running Pythia8 with ROOT getting fatal error: 'Pythia8/Pythia.h' file not found

However, as I still cannot run the macro I decided to reinstall PYTHIA8 and then install ROOT so I can enable build options when building ROOT. So I have installed PYTHIA 8.180 with shared library enabled and ROOT 5.34.36 with pythia8 build option enabled. I tried pythia8.c in /root/tutorials/pythia and it worked out so I think PYTHIA8 could work as a plugin of ROOT.
However, when I run my macro, according to the makefile I should compile with the command make (it’s written by somebody else, so I am not exactly sure what to do) and I got the same error as the post says:

forWong_main.cpp:1:10: fatal error: Pythia8/Pythia.h: No such file or directory
 #include "Pythia8/Pythia.h"
compilation terminated.
Makefile:2: recipe for target 'main' failed
make: *** [main] Error 1

I think I have set my environment variables correctly, that in my .bashrc file I have:

export PYTHIA8=/home/killua/pythia8180
export ROOTSYS=/home/ROOT
export PATH=$ROOTSYS/bin:$PATH
export PATH=${PATH}:/home/killua/pythia8180/bin
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$ROOTSYS/bindings/pyroot:$LD$
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/killua//pythia8180/lib
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/home/killua/pythia8180/lib
export PYTHIA8DATA=/home/killua/pythia8180/xmldoc
export PATH=${PATH}:/home/killua/pythia8180/bin

And I’ve read every post about this error, but the solutions do not solve my problems here.

Can anyone please help me figure out what to do?


find ${PYTHIA8} -name Pythia.h

I got a output


Attach the “Makefile” here.

Thank you!
Makefile.txt (587 Bytes)

What do you get from:

pythia8-config --cppflags --libs --cxxflags

I got this output:


which pythia8-config

I get this output:


So, as you can see it misbehaves. It seems you did not properly configured / built it.

Sorry, I am a bit confused still, do you mean that I did not properly configure/build pythia8? Should I rebuild it and then recompile it?

That’s right. Your pythia8 is not properly configured. I do no know what “pythia8-config” is supposed to return but for sure you should get “-I/home/killua/pythia8180/include” inside.

Just to be safer here, is it okay for me to rebuild PYTHIA8 without rebuilding ROOT? It should be okay right, since I configured ROOT before. Thank you!

No idea. It may work (if you leave it in “/home/killua/pythia8180”) so try it.

My guess is that you need to add “--prefix=/home/killua/pythia8180” when configuring pythia8 (and then “make install”).

1 Like

I tried

like this./configure --enable-shared --prefix=/home/killua/pythia8180
and I got an error message with this:

make[1]: Entering directory '/home/killua/pythia8180'
cp -r include /home/killua/pythia8180/.
cp: 'include' and '/home/killua/pythia8180/./include' are the same file
Makefile:214: recipe for target 'installmain' failed
make[1]: *** [installmain] Error 1
make[1]: Leaving directory '/home/killua/pythia8180

You should unpack the source code (and build it) in a completely different directory (note: “rm -rf /home/killua/pythia8180/” before configuring it again).

Thank you very much, now my code compiles and it runs.

I know this is a PYTHIA issue, but I tried to google it and could not find anything helpful, so I had to bother you here, if you have any clue. I got error message:

PYTHIA Error from LHAPDF::init: you try to use LHAPDF but did not link it  
 PYTHIA Error in Pythia::init: could not set up PDF for beam A ```

Read the “README” included in pythia8, for example.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.