Installation of Madgraph5 with python 3

Asked by Cesare Cazzaniga on 2021-02-16

Hello,

I am supposed to use Madgrpah5 (+Pythia+Delphes) for my master thesis project. I have a Macbook with python 3.8. I have an issue when running ./bin/mg5_amc:

  File "./bin/mg5_amc", line 148, in <module>
    import madgraph.interface.master_interface as interface
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/madgraph/interface/master_interface.py", line 44, in <module>
    import madgraph.interface.madgraph_interface as MGcmd
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/madgraph/interface/madgraph_interface.py", line 71, in <module>
    import madgraph.iolibs.export_cpp as export_cpp
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/madgraph/iolibs/export_cpp.py", line 35, in <module>
    import madgraph.iolibs.helas_call_writers as helas_call_writers
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/madgraph/iolibs/helas_call_writers.py", line 22, in <module>
    import madgraph.loop.loop_helas_objects as loop_helas_objects
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/madgraph/loop/loop_helas_objects.py", line 28, in <module>
    import aloha.create_aloha as create_aloha
  File "/Users/cesarecazzaniga/MG5_aMC_v2_9_2/aloha/create_aloha.py", line 20, in <module>
    import six.moves.cPickle
ModuleNotFoundError: No module named 'six.moves.cPickle'; 'six.moves' is not a package

Do you have any idea of how I can solve this?

Thank you in advance

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
2021-02-16
Last query:
2021-02-16
Last reply:
2021-02-16

I guess your version of the module six is not recent enough.
I would suggest to updated it.
(You can use pip for that)
see
https://github.com/home-assistant-ecosystem/home-assistant-cli/issues/166

Cheers,

Olivier

> On 16 Feb 2021, at 20:05, Cesare Cazzaniga <email address hidden> wrote:
>
> No module named 'six.moves.cPickle';

Cesare Cazzaniga (ccazzaniga) said : #2

Unfortunately it does not solve the problem ... I tried with that solution before .... it gives me the same problem as before ...

What is your version of the six package?

one way to get it is to do
python3

then do
import six
six.__version__

or
[colorordering_2021_merge4]$ pip3 show six
Name: six
Version: 1.15.0
Summary: Python 2 and 3 compatibility utilities
Home-page: https://github.com/benjaminp/six
Author: Benjamin Peterson
Author-email: <email address hidden>
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
Requires:
Required-by: astroid, python-dateutil, cycler

Looking at the documentation, they do not indicate a minimal version for the support of that conversion rule.
so i do not know what is the minimal version needed

Cheers,

Olivier

Cesare Cazzaniga (ccazzaniga) said : #4

yes, doing ... pip3 show six ... I get your same output...

Then I'm not sure to understand. my best guess is that you have another file six.py which conflicts...

Can you do the equivalent of the following:
[HEPToolsInstallers]$ python3.8
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import six
>>> six.__version__
'1.15.0'
>>> import six.moves.cPickle
>>> six.__file__
'/Users/omattelaer/Library/Python/3.8/lib/python/site-packages/six.py'

This will indicate us if you have another file which blocks the pip file or not.

Cheers,

Olivier

Cesare Cazzaniga (ccazzaniga) said : #6

yes, indeed there is a conflict with an other six from a ROOT installation:

import six
>>> six.__version__
'1.4.1'
>>> import six.moves.cPickle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'six.moves.cPickle'; 'six.moves' is not a package
>>> six.__file__
'/Users/cesarecazzaniga/root/myBuild/lib/six.py'

So, what do you suggest to do?

Hi,

I would test to do
mv /Users/cesarecazzaniga/root/myBuild/lib/six.py /Users/cesarecazzaniga/root/myBuild/lib/six.bck
rm /Users/cesarecazzaniga/root/myBuild/lib/six.py?

This should fix the problem on this side but maybe not the one for root (but I guess it should be fine).
Another option is to play with the PYTHONPATH, but you might get the same issue...
A third solution is likely virtual environment but I have never play with that.

Cheers,

Olivier

Cesare Cazzaniga (ccazzaniga) said : #8

Thank you,

I have solved with your suggestion .