Madgraph error on tutorial after update, previously worked fine

Asked by Taylor Gray

Madgraph has previously worked fine on my machine, today I was prompted to update so I ran an update. When testing with the tutorial, I get this error :
Command "output MY_FIRST_MG5_RUN" interrupted with error:
UnboundLocalError : local variable 'identity' referenced before assignment.

I can see where the issue is in the code from this part of the debug file : MG5_aMC_v3_2_0/madgraph/various/banner.py", line 2356, in get_lepton_densities
    if identity not in cls.allowed_lep_densities:
UnboundLocalError: local variable 'identity' referenced before assignment

In the function get_lepton_densities, if this condition "if os.path.isdir(pjoin(check_dir, name)):" is not met, "identity" variable is not defined so in the next line it is undefined. Is there a fix for this?

Here is the debug file:
#************************************************************
#* MadGraph5_aMC@NLO *
#* *
#* * * *
#* * * * * *
#* * * * * 5 * * * * *
#* * * * * *
#* * * *
#* *
#* *
#* VERSION 3.2.0 2021-08-22 *
#* *
#* The MadGraph5_aMC@NLO Development Team - Find us at *
#* https://server06.fynu.ucl.ac.be/projects/madgraph *
#* *
#************************************************************
#* *
#* Command File for MadGraph5_aMC@NLO *
#* *
#* run as ./bin/mg5_aMC filename *
#* *
#************************************************************
set group_subprocesses Auto
set ignore_six_quark_processes False
set low_mem_multicore_nlo_generation False
set complex_mass_scheme False
set include_lepton_initiated_processes False
set gauge unitary
set loop_optimized_output True
set loop_color_flows False
set max_npoint_for_channel 0
set default_unset_couplings 99
set max_t_for_channel 99
set zerowidth_tchannel True
set nlo_mixed_expansion True
import model sm
define p = g u c d s u~ c~ d~ s~
define j = g u c d s u~ c~ d~ s~
define l+ = e+ mu+
define l- = e- mu-
define vl = ve vm vt
define vl~ = ve~ vm~ vt~
tutorial
generate p p > t t~
output MY_FIRST_MG5_RUN
Traceback (most recent call last):
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/interface/extended_cmd.py", line 1544, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/interface/extended_cmd.py", line 1493, in onecmd_orig
    return func(arg, **opt)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/interface/master_interface.py", line 299, in do_output
    self.cmd.do_output(self, line, *args, **opts)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/interface/madgraph_interface.py", line 8145, in do_output
    self.finalize(nojpeg, flaglist=flaglist)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/interface/madgraph_interface.py", line 8478, in finalize
    flaglist)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/iolibs/export_v4.py", line 6191, in finalize
    super(ProcessExporterFortranMEGroup, self).finalize(*args, **opts)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/iolibs/export_v4.py", line 4272, in finalize
    ProcessExporterFortran.finalize(self, matrix_elements, history, mg5options, flaglist)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/iolibs/export_v4.py", line 440, in finalize
    self.create_run_card(matrix_elements, history)
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/iolibs/export_v4.py", line 220, in create_run_card
    run_card = banner_mod.RunCard()
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/various/banner.py", line 2288, in __new__
    RunCard.get_lepton_densities()
  File "/Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/madgraph/various/banner.py", line 2356, in get_lepton_densities
    if identity not in cls.allowed_lep_densities:
UnboundLocalError: local variable 'identity' referenced before assignment
                          MadGraph5_aMC@NLO Options
                          ----------------
        complex_mass_scheme : False
    default_unset_couplings : 99
                      gauge : unitary
         group_subprocesses : Auto
  ignore_six_quark_processes : False
  include_lepton_initiated_processes : False
           loop_color_flows : False
      loop_optimized_output : True
  low_mem_multicore_nlo_generation : False
     max_npoint_for_channel : 0
          max_t_for_channel : 99
        nlo_mixed_expansion : True
               stdout_level : 20 (user set)
         zerowidth_tchannel : True

                         MadEvent Options
                          ----------------
     automatic_html_opening : True
                    nb_core : None
        notification_center : True
                   run_mode : 2

                      Configuration Options
                      ---------------------
                        OLP : MadLoop
   acknowledged_v3.1_syntax : False
         auto_convert_model : True (user set)
                auto_update : 7
         cluster_local_path : None
           cluster_nb_retry : 1
              cluster_queue : None (user set)
         cluster_retry_wait : 300
               cluster_size : 100
      cluster_status_update : (600, 30)
          cluster_temp_path : None
               cluster_type : condor
                    collier : ./HEPTools/lib
               cpp_compiler : None
             crash_on_error : False
               delphes_path : ./Delphes
                 eps_viewer : None
        exrootanalysis_path : ./ExRootAnalysis
              f2py_compiler : None
          f2py_compiler_py2 : None
          f2py_compiler_py3 : None
                    fastjet : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/madanalysis5/madanalysis5/tools/fastjet/bin/fastjet-config (user set)
           fortran_compiler : None
                      golem : None (user set)
                 hepmc_path : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/hepmc (user set)
                  hwpp_path : None (user set)
                     lhapdf : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/lhapdf6_py3/bin/lhapdf-config (user set)
                 lhapdf_py2 : None
                 lhapdf_py3 : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/lhapdf6_py3/bin/lhapdf-config (user set)
          madanalysis5_path : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/madanalysis5/madanalysis5 (user set)
           madanalysis_path : ./MadAnalysis
  mg5amc_py8_interface_path : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/MG5aMC_PY8_interface (user set)
                      ninja : ./HEPTools/lib
        output_dependencies : external
                   pineappl : pineappl
            pythia-pgs_path : ./pythia-pgs
               pythia8_path : /Users/Taylor/Documents/PhD/Code/MG5_aMC_v3_2_0/HEPTools/pythia8 (user set)
                    samurai : None
               syscalc_path : ./SysCalc
                    td_path : ./td
                text_editor : None
                thepeg_path : None (user set)
                    timeout : 60
                web_browser : None

Question information

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

Thanks for the report.

Here is a fix that should avoid the issue:
https://github.com/mg5amcnlo/mg5amcnlo/commit/6828cb86704acca78234f791ee1c0f6b2890e8df

I guess that the update add some backup file in that directory that triggers that issue that no one reported before.

Thanks,

Olivier

Revision history for this message
Taylor Gray (taylorrosegray) said :
#2

Thank you for this fix, Oliver! It works great now.

Taylor

Revision history for this message
Taylor Gray (taylorrosegray) said :
#3

Thanks Olivier Mattelaer, that solved my question.