Difficulty importing ROOT in Python

Hi all,

I’m trying to import ROOT so that I can use it in a python file in VS Code.

The Python file contains the following code:

import sys, os

sys.path.append("/Applications/root_v6.28.00/")
sys.path.append("/Applications/root_v6.28.00/bin/")
sys.path.append("/Applications/root_v6.28.00/include/")
sys.path.append("/Applications/root_v6.28.00/lib/")

import ctypes
ctypes.cdll.LoadLibrary("/Applications/root_v6.28.00/lib//libCore.so")
ctypes.cdll.LoadLibrary("/Applications/root_v6.28.00/lib//libThread.so")
ctypes.cdll.LoadLibrary("/Applications/root_v6.28.00/lib//libTreePlayer.so")

import ROOT

When I run the code, I get this error:

Fatal in <TROOT::InitInterpreter>: cannot load library dlopen(/Users/divitrawal/root/lib/libCling.so, 0x0005): symbol not found in flat namespace '__Z4FormPKcz'

I’m not entirely sure what’s happening, so any help would be greatly appreciated!

ROOT Version: 6.28.00
Platform: MacOS Ventura 13.2
Compiler: Not Provided


Maybe @vpadulan can give some hints

Hi @drawal ,

I am not sure about your approach. In principle, it should be enough to source thisroot.sh if you compiled ROOT on your own. Or, even simpler, just install ROOT via some package manager as described at Installing ROOT - ROOT and then activate the environment where you installed ROOT in your VS code instance.

Cheers,
Vincenzo

Hi @vpadulan,

I installed ROOT through the precompiled binary distribution (I installed the .pkg one) for my system linked on the “Installing ROOT” page and followed the directions in the installation. After that, I did thisroot.sh. I thought that would be enough to setup ROOT, but maybe I missed something?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.