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


import ctypes

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.


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.