Enable PyROOT Ubuntu 14.04

2024/10/12 10:22:48

I downloaded madpgraph5, but when I run it I get the following error:

 ERROR: ROOT file called 'ROOT.py' or 'ROOT.pyc' is not foundERROR: Please check that ROOT is properly installed.

When I try locate ROOT.py and locate ROOT.pyc, I get nothing.

I have root 5.34 installed and it runs smoothly. I also have python 2.7.6 installed.

I downloaded rootpy, but have no idea how to include and enable PyROOT. I searched and I think I have to edit something to do with the path in bashrc, but before I do it I need to be sure of what I am doing.

Can anyone help?

Answer

You have probably figured out how to use it already, so just in case someone else stumbles over this question.

First make sure you built ROOT with Python support, root-config --features should list python.

There are a few possibilities how to successfully use import ROOT in Python:

  1. Add export PYTHONPATH=$PYTHONPATH:$ROOTSYS/lib to your .bashrc where $ROOTSYS is the path to your ROOT installation.
  2. The first way is the easiest, but in case you want to do something like sudo pip install rootpy, your local $PYTHONPATH isn't used. Another way is to copy the files ROOT.py and libPyROOT.so from path_to_root_installation/lib to /usr/lib/pythonX (replace X with your Python version).
  3. Similar to the method above. But in case you recompile ROOT or change something else, a symbolic link might be better: sudo ln -s /path_to_root/lib/ROOT.py /usr/lib/pythonX/ROOT.py and for libPyROOT.so as well.
https://en.xdnf.cn/q/118207.html

Related Q&A

pygal on windows - cannot access classes from pygal

I have such short script:import pygal if __name__ == __main__:bar_chart = pygal.Bar()and following error: AttributeError: module object has no attribute BarDo you have any idea what is wrong? Shall I …

Parsing table for a link

Ive been able to isolate a row in a html table using Beautiful Soup in Python 2.7. Been a learning experience, but happy to get that far. Unfortunately Im a bit stuck on this next bit.I need to get t…

build matrix from blocks

I have an object which is described by two quantities, A and B (in real case they can be more than two). Objects are correlated depending on the value of A and B. In particular I know the correlation m…

How to convert string with UTC offset

I have date as In [1]: a = "Sun 10 May 2015 13:34:36 -0700"When I try to convert it using strptime, its giving error.In [3]: datetime.strptime(a, "%a %d %b %Y %H:%M:%S %Z"...: ) ---…

regex multiline not working on repeated patterns

I am trying to get a regex expression to match multiple patterns with multilines but it keeps matching everything. For instance I want to match two times this code:STDMETHOD(MyFunc)( D2D1_SIZE_U size, …

Django Rest Framework slug_field error

I have this serializer and model. I want to show in my API the field username of User model, but I receive this error.AttributeError at /api/v1/client_share_requests/1/Profile object has no attribute u…

Django - 500 internal server error no module named django

django return 500 internal server error (apache 2.4.10, ubuntu 15.04, django 1.9.6)apache log:[wsgi:warn] mod_wsgi: Compiled for Python/3.4.2. [wsgi:warn] mod_wsgi: Runtime using Python/3.4.3. [mpm_eve…

Unable to connect to Google Bigtable using HBase REST api

Following this example, running the test script "python put_get_with_client.py" results in a 400 error (Bad Request).Bad requestjava.lang.ClassCastException: org.apache.hadoop.hbase.client.Bi…

HTML form button to run PHP to execute Python script

I am building an HTML document that is meant to run locally. On it is a button that I would like to have run a Python script when clicked. Im trying to use a PHP-generated button. Theres no input or ou…

Python - finding time slots

I am writing a small Python script to find time available slots based off calendar appointments. I was able to reuse the code on the post here: (Python - Algorithm find time slots).It does seem to wor…