Madgraph won't run with python 3

Asked by Yehia Abdelaziz

I can't run madgraph with python3 through the cmd " ./bin/mg5_aMC" it gives the following error

madgraph requires the six module. The easiest way to install it is to run "pip3 install six --user"
in case of problem with pip, you can download the file at https://pypi.org/project/six/ . It has a single python file that you just need to put inside a directory of your $PYTHONPATH environment variable.

when I run "pip3 install six --user" it gives me the following error

Requirement already satisfied: six in ./.local/lib/python3.6/site-packages

I have python 3.9 installed

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Yehia Abdelaziz
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Do you have pip3.9 install on your machine ?
Looks like your pip3 path is linked to python3.6.

Otherwise you can put the file
./.local/lib/python3.6/site-packages/six.py
within another directory and update your $PYTHONPATH (or put that file within the MG5_aMC directory that should work too)

Cheers,

Olivier

Revision history for this message
Yehia Abdelaziz (yehia95) said :
#2

I copied the file six.py into a directory and updated $PYTHONPATH but now it gives me another error :
For tab completion and history, install module readline.
Traceback (most recent call last):
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/./bin/mg5_aMC", line 148, in <module>
    import madgraph.interface.master_interface as interface
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/madgraph/interface/master_interface.py", line 40, in <module>
    import madgraph.core.diagram_generation as diagram_generation
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/madgraph/core/diagram_generation.py", line 31, in <module>
    import madgraph.core.base_objects as base_objects
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/madgraph/core/base_objects.py", line 28, in <module>
    import madgraph.core.color_algebra as color
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/madgraph/core/color_algebra.py", line 24, in <module>
    import madgraph.various.misc as misc
  File "/home/yabdelaziz/Software/MG5_aMC_v3_1_1/madgraph/various/misc.py", line 32, in <module>
    import gzip as ziplib
  File "/usr/local/lib/python3.9/gzip.py", line 9, in <module>
    import zlib
ModuleNotFoundError: No module named 'zlib'

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#3

Did you check this link:
https://stackoverflow.com/questions/6169522/no-module-named-zlib <https://stackoverflow.com/questions/6169522/no-module-named-zlib>

This is a python internal error not related to MG5aMC

Cheers,

Olivier

> On 24 Aug 2021, at 01:25, Yehia Abdelaziz <email address hidden> wrote:
>
> ModuleNotFoundError: No module named 'zlib'

Revision history for this message
Yehia Abdelaziz (yehia95) said :
#4

It was really a python 3 problem, it worked after installing it again.
Thank you