Install MadGraph5 as root

Asked by Ramon Berger on 2020-09-17

I would like to install MadGraph on a server as root and have non root users run the program. But I run into problems with permission s when trying to copy make_opts I think

Traceback (most recent call last):
  File "/usr/local/src/MG5_aMC_v2_8_0/bin/mg5_aMC", line 165, in <module>
    cmd_line = interface.MasterCmd(mgme_dir = options.mgme_dir)
  File "/usr/local/src/MG5_aMC_v2_8_0/madgraph/interface/master_interface.py", line 612, in __init__
    self.cmd.__init__(self, *args, **opt)
  File "/usr/local/src/MG5_aMC_v2_8_0/madgraph/interface/madgraph_interface.py", line 3026, in __init__
    shutil.copy(make_opts_source, make_opts)
  File "/usr/local/anaconda38/lib/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/local/anaconda38/lib/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/usr/local/src/MG5_aMC_v2_8_0/Template/LO/Source/make_opts'

Is there a way of dealing with this?

Thanks for any info....
Ramon Berger

Question information

Language:
English Edit question
Status:
Expired
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2020-09-17
Last reply:
2020-10-03
Mia89878 (miajonsan) said : #1

Verify that your computer is running a Linux operating system. If not, this operating
system can be found for free online, though the installation process is somewhat
advanced.
2. Open a new terminal window. If you are unfamiliar with this program, use your
computer’s search function to locate it. (More information about the terminal can be
found in the glossary).
3. Type “$ python –version” into the terminal. You must have version 2.6 or 2.7 of
Python for MadGraph to work correctly. Most computers within the past few years
should be fine.
Complete and submit the form, and wait for the email with your username and
password to arrive. After receiving that email, click on the “Downloads” link in the
main menu on the MadGraph website, and log in.
3. Download the most recent version of MadGraph once you can access the
“Downloads” section of the website: MadGraph5_aMC@NLO. Since this is a
.tar.gz file you may have to download it by right clicking the link on the left side of
the page and selecting “Save Link As”. Save this file to the location in which you
want to install and run MadGraph.
4. Extract the MadGraph files from the compressed directory either by right clicking
and selecting “Extract” or by typing “$tar -xvf MadGraph5_aMC_v2.2.3.tar.gz” into
the terminal. Note: You must navigate to the location of your MadGraph download
using the cd command for the above to work properly. Make sure you use whatever
name is associated with the .tar.gz file you downloaded.
5. Move into the directory created from extracting the files using the cd command.
“$cd <Name_of_your_MadGraph_Directory>

Dear Ramon,

Hi typically consider that they are no gain to make a central installation of MG5aMC.
However a nice trick for cluster is to define the following environment variable:
MADGRAPH_BASE=/nfs/soft/madgraph/
and in that directory have one configuration file for MG5aMC:

[omatt@ingrid-ui1 omatt]$ cat /nfs/soft/madgraph/mg5_configuration.txt
nb_core=5
run_mode=1
automatic_html_opening=False
cluster_size = 150
cluster_local_path = /cvmfs/cp3.uclouvain.be/madgraph/
cluster_status_update = 900 60
cluster_type = slurm
cluster_retry_wait = 300
lhapdf=/cvmfs/cp3.uclouvain.be/lhapdf/lhapdf-6.1.5_amd64_gcc44/bin/lhapdf-config

This will allow all your user to have the correct cluster/... setup (by default) for any run that they attempt for any version of MG5aMC that they use.

Obviously this is not the direct answer to your question.
if you really want to setup the madgraph directory in read-only,
then you have first to run the following script:
./bin/compile.py

I know ATLAS is using that method, but at the same time they do not run the shower/... from within the code so I would not be surprised that you will face some issue from this readonly mode.

Cheers,

Olivier

Also worth mentioning,

In the past, running the command "install update" as root. was wiping all the data of the machine....
So avoid to run any command as root (including ./bin/compile.py) or use a virtual environment.

Cheers,

Olivier

Ramon Berger (rwberger) said : #4

Oliver,

Thanks so much! I'll give this a try.

I've been asked to set up MadGraph on a server for a number of students.
I'm not familiar with the application but it seems to me that it is
designed to run from an individual's account. I just though it would be
nice to do the install for the users as root and then have them each be
able to run it without having to install it.

I appreciate your response.

Ramon

On 9/16/20 11:50 PM, Olivier Mattelaer wrote:
> Your question #692970 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/692970
>
> Status: Open => Answered
>
> Olivier Mattelaer proposed the following answer:
> Dear Ramon,
>
> Hi typically consider that they are no gain to make a central installation of MG5aMC.
> However a nice trick for cluster is to define the following environment variable:
> MADGRAPH_BASE=/nfs/soft/madgraph/
> and in that directory have one configuration file for MG5aMC:
>
> [omatt@ingrid-ui1 omatt]$ cat /nfs/soft/madgraph/mg5_configuration.txt
> nb_core=5
> run_mode=1
> automatic_html_opening=False
> cluster_size = 150
> cluster_local_path = /cvmfs/cp3.uclouvain.be/madgraph/
> cluster_status_update = 900 60
> cluster_type = slurm
> cluster_retry_wait = 300
> lhapdf=/cvmfs/cp3.uclouvain.be/lhapdf/lhapdf-6.1.5_amd64_gcc44/bin/lhapdf-config
>
> This will allow all your user to have the correct cluster/... setup (by
> default) for any run that they attempt for any version of MG5aMC that
> they use.
>
> Obviously this is not the direct answer to your question.
> if you really want to setup the madgraph directory in read-only,
> then you have first to run the following script:
> ./bin/compile.py
>
> I know ATLAS is using that method, but at the same time they do not run
> the shower/... from within the code so I would not be surprised that you
> will face some issue from this readonly mode.
>
> Cheers,
>
> Olivier
>
--
=============
Ramon Berger
Computer Systems Administrator
Physical and Biological Science Division
University of California Santa Cruz

Ramon Berger (rwberger) said : #5

Oliver,

I haven't tried your suggestion yet.

Ramon

On 9/17/20 8:41 AM, Ramon Berger wrote:
> Your question #692970 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/692970
>
> Status: Answered => Open
>
> You are still having a problem:
> Oliver,
>
> Thanks so much! I'll give this a try.
>
> I've been asked to set up MadGraph on a server for a number of students.
> I'm not familiar with the application but it seems to me that it is
> designed to run from an individual's account. I just though it would be
> nice to do the install for the users as root and then have them each be
> able to run it without having to install it.
>
> I appreciate your response.
>
> Ramon
>
> On 9/16/20 11:50 PM, Olivier Mattelaer wrote:
>> Your question #692970 on MadGraph5_aMC@NLO changed:
>> https://answers.launchpad.net/mg5amcnlo/+question/692970
>>
>> Status: Open => Answered
>>
>> Olivier Mattelaer proposed the following answer:
>> Dear Ramon,
>>
>> Hi typically consider that they are no gain to make a central installation of MG5aMC.
>> However a nice trick for cluster is to define the following environment variable:
>> MADGRAPH_BASE=/nfs/soft/madgraph/
>> and in that directory have one configuration file for MG5aMC:
>>
>> [omatt@ingrid-ui1 omatt]$ cat /nfs/soft/madgraph/mg5_configuration.txt
>> nb_core=5
>> run_mode=1
>> automatic_html_opening=False
>> cluster_size = 150
>> cluster_local_path = /cvmfs/cp3.uclouvain.be/madgraph/
>> cluster_status_update = 900 60
>> cluster_type = slurm
>> cluster_retry_wait = 300
>> lhapdf=/cvmfs/cp3.uclouvain.be/lhapdf/lhapdf-6.1.5_amd64_gcc44/bin/lhapdf-config
>>
>> This will allow all your user to have the correct cluster/... setup (by
>> default) for any run that they attempt for any version of MG5aMC that
>> they use.
>>
>> Obviously this is not the direct answer to your question.
>> if you really want to setup the madgraph directory in read-only,
>> then you have first to run the following script:
>> ./bin/compile.py
>>
>> I know ATLAS is using that method, but at the same time they do not run
>> the shower/... from within the code so I would not be surprised that you
>> will face some issue from this readonly mode.
>>
>> Cheers,
>>
>> Olivier
>>
--
=============
Ramon Berger
Computer Systems Administrator
Physical and Biological Science Division
University of California Santa Cruz

Launchpad Janitor (janitor) said : #6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Mia89878 (miajonsan) said : #7

Verify that your computer is running a Linux operating system. If not, this operating
system can be found for free online, though the installation process is somewhat
advanced.
2. Open a new terminal window. If you are unfamiliar with this program, use your
computer’s search function to locate it. (More information about the terminal can be
found in the glossary).
3. Type “$ python –version” into the terminal. You must have version 2.6 or 2.7 of
Python for MadGraph to work correctly. Most computers within the past few years
should be fine.
. Go to the MadGraph website: http://madgraph.physics.illinois.edu/ and click on the
“account” link under the “Downloads” option on the main menu at the top of the
page.
2. Complete and submit the form, and wait for the email with your username and
password to arrive. After receiving that email, click on the “Downloads” link in the
main menu on the MadGraph website, and log in.
3. Download the most recent version of MadGraph once you can access the
“Downloads” section of the website: MadGraph5_aMC@NLO. Since this is a
.tar.gz file you may have to download it by right clicking the link on the left side of
the page and selecting “Save Link As”. Save this file to the location in which you
want to install and run MadGraph.
4. Extract the MadGraph files from the compressed directory either by right clicking
and selecting “Extract” or by typing “$tar -xvf MadGraph5_aMC_v2.2.3.tar.gz” into
the terminal. Note: You must navigate to the location of your MadGraph download
using the cd command for the above to work properly. Make sure you use whatever
name is associated with the .tar.gz file you downloaded.
5. Move into the directory created from extracting the files using the cd command.
“$cd <Name_of_your_MadGraph_Directory>
6. Type “$./bin/mg5_aMC”
into the terminal and hit
enter. MadGraph should
start in the terminal, as you
can see in Figure 1.
Section 3: Installation of Additional Packages
1. Make sure MadGraph is running, or restart the program as in step 6 in section 2
above.
2. Type “>install MadAnalysis” into the MadGraph interface in the terminal to install
MadAnalysis. Wait for that process to complete.
3. Type “>install pythia-pgs” into the MadGraph interface in the terminal to install
Pythia 6. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end.
4. Type “>install ExRootAnalysis” into the MadGraph interface in the terminal to install
ExRootAnalysis. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end. Note: You will need to have ROOT installed for
this step to work properly.
5. Type “>exit” to close the MadGraph program and return to the main terminal
prompt, in the MadGraph folder.
Figure 1: The MadGraph
logo, as it appears in the
terminal when MadGraph is
started as in Step 6 of
Section 2
Section 3: Installation of Additional Packages
1. Make sure MadGraph is running, or restart the program as in step 6 in section 2
above.
2. Type “>install MadAnalysis” into the MadGraph interface in the terminal to install
MadAnalysis. Wait for that process to complete.
3. Type “>install pythia-pgs” into the MadGraph interface in the terminal to install
Pythia 6. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end.
4. Type “>install ExRootAnalysis” into the MadGraph interface in the terminal to install
ExRootAnalysis. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end. Note: You will need to have ROOT installed for
this step to work properly.
5. Type “>exit” to close the MadGraph program and return to the main terminal
prompt, in the MadGraph folder.
Figure 1: The MadGraph
logo, as it appears in the
terminal when MadGraph is
started as in Step 6 of
Section 2.
Page 5
Section 4: Basic Use of MadGraph
1. Start MadGraph as in step 6 of section 2 above.
2. Type “> import standard model” to load the Standard Model of particles and
coupling values into MadGraph as seen below in Figure 2.
3. Type “> generate p p > t
t~” which creates a protonproton collision decaying to
a top quark anti-top quark
pair, which can also be
seen in Figure 2.
4. Type “> output ttbar_test”, which creates the Feynman Diagrams and the output
folder named “ttbar_test” which will hold all the files associated with this simulation.
5. Type “> launch ttbar_test” to generate actual events. This should produce a menu
where you have the option to run additional programs on the MadGraph output.
6. Type 1 and hit enter. This returns you to the same menu, but now with ON at the
end of the Pythia line. Most of the time you will want to run Pythia on the output
from MadGraph because Pythia hadronizes the MadGraph output.
7. Press enter to continue past the program selector menu. If you want to run
additional programs enter those numbers one at a time into the terminal and hit
enter after each to turn those programs on, before continuing past the menu.
8. Hit enter again to bypass the card file editing menu. After the program selector
menu you should have seen another menu with the option of editing card files.
Editing the card files allows you to change the number of events the simulation
produces, as well as the masses and coupling constants of the particles involved.
For this simple simulation we didn’t change anything, and instead just hit enter to
continue past that menu.
Figure 2: The commands from
Steps 2 and 3 of Section 4 are
circled. The rest of the text is
the output from these two
commands in the screenshot.
4. Type “> output ttbar_test”, which creates the Feynman Diagrams and the output
folder named “ttbar_test” which will hold all the files associated with this simulation.
5. Type “> launch ttbar_test” to generate actual events. This should produce a menu
where you have the option to run additional programs on the MadGraph output.
6. Type 1 and hit enter. This returns you to the same menu, but now with ON at the
end of the Pythia line. Most of the time you will want to run Pythia on the output
from MadGraph because Pythia hadronizes the MadGraph output.
7. Press enter to continue past the program selector menu. If you want to run
additional programs enter those numbers one at a time into the terminal and hit
enter after each to turn those programs on, before continuing past the menu.
8. Hit enter again to bypass the card file editing menu. After the program selector
menu you should have seen another menu with the option of editing card files.
Editing the card files allows you to change the number of events the simulation
produces, as well as the masses and coupling constants of the particles involved.
For this simple simulation we didn’t change anything, and instead just hit enter to
continue past that menu.
Figure 2: The commands from
Steps 2 and 3 of Section 4 are
circled. The rest of the text is
the output from these two
commands in the screenshot.
Page 6
9. Watch the output as it is produced. Your web browser should open to a page
displaying the cross section of the simulated process. After all events have been
produced the terminal should return to the normal MadGraph input prompt.
10. Open your file navigator. The output files from MadGraph can be found at the
location: <MadGraph_Install>/<Name_from_step4.4>/Events/run_01/. There
should be a .root file and a .tar.gz LHE file for both the MadGraph and Pythia
output.
11. Use the Pythia ROOT file and LHE file for most analysis. In general, you will want
the output to be hadronized, which is what Pythia does.
P

Mia89878 (miajonsan) said : #8

The Path environment variable is a variable you can define and
modify within your .bashrc file. It tells your operating system where
to find programs that it may need to access.
Pythia 6 is a simulation program for producing particle collision
simulations at very high energies, as well as taking simulations as
input and hadronizing particles that should be hadronized.
Python Python is a high-level, multipurpose programming language. Many
software systems have components written in Python.
ROOT ROOT is an object-oriented software system and library developed
by CERN. It was designed for particle physics data analysis but is
applicable in multiple additional fields.
Standard Model The Standard Model is the theory that physicists currently believe
of Particle describe all known particles with the greatest detail and the
Physics greatest accuracy.
.tar.gz File A TAR file refers to a Tape ARchive file. The .gz refers to a zipped
file, a form of file compression that is also used in Windows
environments. .tar.gz is a standard form of compression in the
Linux OS.
Terminal The Terminal, also known as the command line or shell, is an
an application where you can type and execute computer commands
directly.
Terminal Prompt The Terminal Prompt is the location in the terminal where you can
type commands. https://thesmokerreviews.com/ On a Linux OS it usually looks like a dollar sign

isabellsophie (isabellsophie) said : #9

The purpose of this guide is to describe how to install and use MadGraph for
basic high energy physics particle collision simulations. This simulated data assists
scientists in analyzing actual data produced by particle accelerators, colliders, and
detectors. The abundance of data from these sources requires prior knowledge to help
guide analysis, knowledge that comes from theoretical simulations. These simulations
are produced using software such as MadGraph. Theories and particle descriptions, like
mass and coupling values that govern the way the particles interact with each other,
are input into the software which then outputs the data for each particle present after
the collision has occurred, or each particle in the event. These events are simply a
collection of the locations and energies of all particles resulting from the collision of two
protons.
The overall output of the software is this information formatted in a way that
allows for analysis of the whole simulation. These results allow scientists to hone their
analysis techniques and study possible results that might be seen in actual data. In
addition, these simulations can help physicists separate out the most important events
from the common and less interesting ones, which is much more difficult than it
sounds. MadGraph is one of the most commonly used software for generating simulated
particle collision events, and this guide on how to install, integrate, and use the
software is meant to help beginning researchers and scientists to do their jobs.
To use this guide, you’ll need a computer running a Linux operating system (if
you’re familiar with the command line you could also generalize these instructions to a
Macintosh computer running iOS). You’ll also need a good internet connection to access
the original download of the software. It helps to know basic Linux terminal commands,
but it’s not required. Necessary commands will be given and explained within the guide.
This guide will walk you through how to install and integrate MadGraph into the
already existing analysis tools on your computer. Any words that are underlined are
included in the glossary of terms. In addition, any coding instructions that should be
typed into the terminal will be listed as “$ coding_instruction”. This should be typed into
the terminal without the quotation marks or the dollar sign, which indicates the
beginning of the terminal prompt. Any coding instructions with brackets <> indicate a
place where you should insert the name of your file or directory instead of the typed
name, without the brackets. Commands that should be typed into the MadGraph
interface are formatted as “> command”, since that is how the MadGraph interface
appears, and again should be typed without the quotes or the > symbol.
Page 3
Installing and Using MadGraph
Section 1: System Verification
1. Verify that your computer is running a Linux operating system. If not, this operating
the system can be found for free online, though the installation process is somewhat
advanced.
2. Open a new terminal window. If you are unfamiliar with this program, use your
computer’s search function to locate it. (More information about the terminal can be
found in the glossary).
3. Type “$ python –version” into the terminal. You must have version 2.6 or 2.7 of
Python for MadGraph to work correctly. Most computers within the past few years
should be fine.
Section 2: Installation of MadGraph
1. Go to the MadGraph website: and click on the
“Account” link under the “Downloads” option on the main menu at the top of the
page.
2. Complete and submit the form, and wait for the email with your username and
password to arrive. After receiving that email, click on the “Downloads” link in the
main menu on the MadGraph website, and log in.
3. Download the most recent version of MadGraph once you can access the
“Downloads” section of the website: MadGraph5_aMC@NLO. Since this is a
.tar.gz file you may have to download it by right-clicking the link on the left side of
the page and selecting “Save Link As”. Save this file to the location in which you
want to install and run MadGraph.
4. Extract the MadGraph files from the compressed directory either by right-clicking
and selecting “Extract” or by typing “$tar -xvf MadGraph5_aMC_v2.2.3.tar.gz” into
the terminal. Note: You must navigate to the location of your MadGraph download
using the cd command for the above to work properly. Make sure you use whatever
name is associated with the .tar.gz file you downloaded.
5. Move into the directory created from extracting the files using the cd command.
“$cd <Name_of_your_MadGraph_Directory>
Page 4

isabellsophie (isabellsophie) said : #10

Type “$./bin/mg5_aMC”
into the terminal and hit
enter. MadGraph should
start in the terminal, as you
can see in Figure 1.
Section 3: Installation of Additional Packages
1. Make sure MadGraph is running, or restart the program as in step 6 in section 2
above.
2. Type “>install MadAnalysis” into the MadGraph interface in the terminal to install
analysis. Wait for that process to complete.
3. Type “>install Pythia-pgs” into the MadGraph interface in the terminal to install
Pythia 6. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end.
4. Type “>install ExRootAnalysis” into the MadGraph interface in the terminal to install
ExRootAnalysis. Wait for this process to complete, and check to make sure it says
“Compilation Succeeded” at the end. Note: You will need to have ROOT installed for
this step to work properly.
5. Type “>exit” to close the MadGraph program and return to the main terminal
prompt, in the MadGraph folder.
Figure 1: The MadGraph
logo, as it appears in the
terminal when MadGraph is
started as in Step 6 of
Section 2.
Page 5
Section 4: Basic Use of MadGraph
1. Start MadGraph https://techquare.com/ as in step 6 of section 2 above.
2. Type “> import standard model” to load the Standard Model of particles and
coupling values into MadGraph as seen below in Figure 2.
3. Type “> generate p p > t
t~” which creates a proton-proton collision decaying to
a top quark anti-top quark
pair, which can also be
seen in Figure 2.
4. Type “> output ttbar_test”, which creates the Feynman Diagrams and the output
a folder named “ttbar_test” which will hold all the files associated with this simulation.
5. Type “> launch ttbar_test” to generate actual events. This should produce a menu
where you have the option to run additional programs on the MadGraph output.
6. Type 1 and hit enter. This returns you to the same menu, but now with ON at the
end of the Pythia line. Most of the time you will want to run Pythia on the output
from MadGraph because Pythia harmonizes the MadGraph output.
7. Press enter to continue past the program selector menu. If you want to run
additional programs enter those numbers one at a time into the terminal and hit
enter after each to turn those programs on, before continuing past the menu.
8. Hit enter again to bypass the card file editing menu. After the program selector
the menu you should have seen another menu with the option of editing card files.
Editing the card files allows you to change the number of events the simulation
produces, as well as the masses and coupling constants of the particles involved.
For this simple simulation we didn’t change anything, and instead just hit enter to
continue past that menu.
Figure 2: The commands from
Steps 2 and 3 of Section 4 are
circled. The rest of the text is
the output from these two
commands in the screenshot.