Problem loading a Pickle file storing dict of histograms with pyROOT

Hi,

I’ve been storing histograms organized in Python dictionaries in pickle files.
Everything worked fine with lxplus7. but now that it has been shut down, I get the following error when trying to load a pickle file:

  File ".../DiTauHistLoader.py", line 31, in load_hists
    pickle_dict = pickle.load(f)      
ModuleNotFoundError: No module named 'libROOTPythonizations3_6'

It seems I can’t find a ROOT version supporting Python 3.6.
Is there any way to rescue these pickle files?

Thank you for any help and sorry if I missed any technical detail.

Best,
Gadi

Welcome to the ROOT Forum!
Let’s ask someone who knows Python better than me… @vpadulan or @jonas maybe?

Hello!

until ROOT 6.32, the PyROOT module encodes the name of the Python version at ROOT compile time in the module name. So you can’t use ROOT with any other Python version later. Apparently, you are reading back the pickle files with a ROOT version that was compiled against a different Python version.

If you use a ROOT version that was built against the same Python version for reading and writing the pickle files, it should work.

In ROOT 6.32, we dropped this Python version suffix in the module name, so you can use ROOT with any Python 3 version after it was built. So maybe moving to 6.32 would solve your problem.

In general, I/O with pickle is often quite fragile, and we recommend you to use ROOT files of course :slight_smile:

Cheers,
Jonas

1 Like