Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Last active February 26, 2022 08:17
Show Gist options
  • Save MohamedElashri/dab00a84ba6a65f99fb2694504ecc39e to your computer and use it in GitHub Desktop.
Save MohamedElashri/dab00a84ba6a65f99fb2694504ecc39e to your computer and use it in GitHub Desktop.
This is the way to install ROOT CERN in Google Colab,.
# This code is for installing ROOT on Google Colab to be able to install root_numpy and root_pandas package later
# for version of this code which work with python3 visit
#https://gist.github.com/MohamedElashri/1b0367992988f053a02dbfd5797fb59e
!mkdir -p APPS
!pwd
!cd APPS && wget https://root.cern.ch/download/root_v6.13.08.Linux-ubuntu18-x86_64-gcc7.3.tar.gz
!cd APPS && tar -xf root_v6.13.08.Linux-ubuntu18-x86_64-gcc7.3.tar.gz
import sys
sys.path.append("/content/APPS/root/lib")
import ctypes
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMultiProc.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libCore.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libThread.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libImt.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libRIO.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libNet.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libGraf3d.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libTreePlayer.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMultiProc.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libTree.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMathCore.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libMatrix.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libHist.so')
ctypes.cdll.LoadLibrary('/content/APPS/root/lib/libGraf.so')
import ROOT
h = ROOT.TH1F("gauss","Example histogram",100,-4,4)
h.FillRandom("gaus")
c = ROOT.TCanvas("myCanvasName","The Canvas Title",800,600)
h.Draw()
c.Draw()
@RussMarro
Copy link

Hi Mohamed,

Thank you so much for this! It worked great for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment