-
-
Save MohamedElashri/1b0367992988f053a02dbfd5797fb59e to your computer and use it in GitHub Desktop.
# Step 1: Download the pre-built ROOT tarball from GitHub Releases | |
!wget -q --show-progress https://github.com/MohamedElashri/ROOT/releases/download/v6.30.04_python11/root_v6.30.04_Ubuntu_Python3.11.zip | |
# Step 2: Extract the ROOT files | |
!unzip -q root_v6.30.04_Ubuntu_Python3.11.zip | |
# Step 3: Install missing system dependencies for ROOT | |
!sudo ldconfig & apt-get install -y git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev tar gfortran subversion libpython3.11-dev | |
# Step 4: Remove the tarball to free up space | |
!rm -f root_v6.30.04_Ubuntu_Python3.11.zip | |
# Step 5: Install Compatible libssl | |
!wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb | |
!sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb | |
!rm -f libssl1.1_1.1.1f-1ubuntu2_amd64.deb | |
import sys | |
sys.path.append("/content/root_build/") | |
sys.path.append("/content/root_build/bin/") | |
sys.path.append("/content/root_build/include/") | |
sys.path.append("/content/root_build/lib/") | |
import ctypes | |
ctypes.cdll.LoadLibrary('/content/root_build/lib//libCore.so') | |
ctypes.cdll.LoadLibrary('/content/root_build/lib//libThread.so') | |
ctypes.cdll.LoadLibrary('/content/root_build/lib//libTreePlayer.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() |
Hi Mohamed. Today 21/02/2025, how to install the ROOT CERN in Google Colab on https://colab.research.google.com/ ?
Thanks in advance !
Hi Mohamed. Today 21/02/2025, how to install the ROOT CERN in Google Colab on colab.research.google.com ?
Thanks in advance !
Hi it seems colab again updated python version to be py3.11 so the current will not work.
I have built ROOT v6.30.04 for py3.11 and uploaded it to releases. So you can use the example in this notebook which will work.
I think I will need more organized and automated way to do this which I'm currently implementing that will not rely on manual work. I will update this gist when I'm done.
Olá Mohamed. Hoje 21/02/2025, como instalar o ROOT CERN no Google Colab em colab.research.google.com ?
Desde já, obrigado !Olá, parece que o Colab atualizou novamente a versão do Python para py3.11, então a atual não funcionará.
Eu construí o ROOT v6.30.04 para py3.11 e o carreguei para releases. Então você pode usar o exemplo neste notebook que funcionará.
Acho que vou precisar de uma maneira mais organizada e automatizada de fazer isso, que estou implementando atualmente, que não dependerá de trabalho manual. Atualizarei este gist quando terminar.
Thank you Mohamed. It is good to hear that someone wants to help us with this question!!
When I run the code it returns the following error on the line ctypes.cdll.LoadLibrary("root_build/lib/libCore.so")
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38' not found (required by root_build/lib/libCore.so)
When I run the code it returns the following error on the line ctypes.cdll.LoadLibrary("root_build/lib/libCore.so")
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38' not found (required by root_build/lib/libCore.so)
Sorry I did this mistake. I will fix it but will take two hours until build get updated. in the mean time change the downloaded link in first cell by this zip file. Change the first line to this.
!wget -q --show-progress https://github.com/MohamedElashri/ROOT/releases/download/ubuntu/root_v6.30.04_Ubuntu_Python3.11.zip
Or just try to work from this notebook
It's working for now
It's working for now
Great, enjoy using it and please tell if at any point it stopped working.
When i try to import root_numpy it gives me
Thank you!
There are several problems
1- You didn't install root_numpy
2- root_numpy
is not part of ROOT and is a separate software
3- It is unmaintained for years now and not will work with new python version (certainly not on Colab)
So you shouldn't use it but work with PyROOT
which is the python wrapper of ROOT that this installs.
Update: I built a ROOT version with python3.10 and updated the gist. You can use the method now without
python3.6
virtual env trick. Example is provided hereI forgot to add that I updated the ROOT version to
v6.28
instead of the oldv6.14