Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dill 0.2.9 works for serialization of ROOT classes in python2, but fails for python3 #356

Closed
VanyaBelyaev opened this issue Jan 21, 2020 · 15 comments

Comments

@VanyaBelyaev
Copy link

With a great success I am using for my project ostap (https://github.com/OstapHEP/ostap) a nice pathos suite (pathos, multiprocess and ppft) together with ROOT project (https://github.com/root-project/root). It helps me a lot - thank you very much for this powerful tool! Everything works for me with python2( e.g. 2.7.16), but dill (0.2.9) fails with python3 (3.6.5).
Surprisingly, a plain pickle works for this case.

import ROOT, pickle, dill 
h = ROOT.TH1D()
pickle.dumps ( h )  ## ok 
dill.dumps ( h ) ## fails

Is it a problem from the dill side?

@VanyaBelyaev
Copy link
Author

is there a chance for fix?

@mmckerns
Copy link
Member

Can you post the traceback, after doing dill.detect.trace(True)? Can you also tell me what OS you are using (mainly because there was just a python3 window-specific fix)?

@VanyaBelyaev
Copy link
Author

VanyaBelyaev commented May 29, 2020

Dear Mike,
I am using linux, CentOS7
the trace is here

  File "./test_dill.py", line 14, in <module>
    print ( dill  .dumps( h ) )
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 294, in dumps
    dump(obj, file, protocol, byref, fmode, recurse)#, strictio)
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 287, in dump
    pik.dump(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 437, in dump
    self.save(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 637, in save_reduce
    save(func)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1064, in save_builtin_method
    pickler.save_reduce(_get_attr, (module, obj.__name__), obj=obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 638, in save_reduce
    save(args)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 774, in save_tuple
    save(element)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1269, in save_module
    state=_main_dict)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 890, in _batch_setitems
    save(v)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 819, in save_list
    self._batch_appends(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 846, in _batch_appends
    save(tmp[0])
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 633, in save_reduce
    save(cls)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1330, in save_type
    StockPickler.save_global(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 960, in save_global
    (obj, module_name, name)) from None
_pickle.PicklingError: Can't pickle <class '_pythonization.compose_method.<locals>.composition_pythonizor'>: it's not found as _pythonization.compose_method.<locals>.composition_pythonizor

@mmckerns
Copy link
Member

mmckerns commented May 30, 2020

This is the trace you get with dill.detect.trace(True)?

I also note that there's this line:

File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 902, in save_module_dict

which I believe corresponds to saving the globals (easier to tell if I can see the debug trace). That tells me it might be possible to use one of the alternate settings, specifically, dill.settings['recurse'] = True (or alternately recurse=True within dump. Can you try that as well?

@VanyaBelyaev
Copy link
Author

VanyaBelyaev commented May 30, 2020

Hi Mike,
the full trace is here

[ibelyaev@lbcsrv01 TEST]$ python ./test_dill.py
VERSIONS: ROOT & PYTHON:  6.20/02 sys.version_info(major=3, minor=7, micro=6, releaselevel='final', serial=0)
PICKLE:
DILL: 0.2.9
B3: <built-in function _ObjectProxy__expand__>
F2: <function _get_attr at 0x7fbbcd5ae560>
# F2
M1: <module 'libPyROOT' from '/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/libPyROOT.so'>
F2: <function _import_module at 0x7fbbcd5ae680>
# F2
D2: <dict object at 0x7fbbcd55a500>
T4: <class '_frozen_importlib.ModuleSpec'>
# T4
D2: <dict object at 0x7fbbe51c6500>
T4: <class '_frozen_importlib_external.ExtensionFileLoader'>
# T4
D2: <dict object at 0x7fbbe51c64b0>
# D2
# D2
B3: <built-in function CreateScopeProxy>
# B3
B3: <built-in function GetCppGlobal>
# B3
B3: <built-in function LookupCppEntity>
# B3
B3: <built-in function SetRootLazyLookup>
# B3
B3: <built-in function MakeRootTemplateClass>
# B3
B3: <built-in function _DestroyPyStrings>
# B3
B3: <built-in function _ResetRootModule>
# B3
B3: <built-in function ClearProxiedObjects>
# B3
B3: <built-in function AddressOf>
# B3
B3: <built-in function addressof>
# B3
B3: <built-in function AsCObject>
# B3
B3: <built-in function as_cobject>
# B3
B3: <built-in function BindObject>
# B3
B3: <built-in function bind_object>
# B3
B3: <built-in function MakeNullPointer>
# B3
B3: <built-in function _ObjectProxy__expand__>
# B3
B3: <built-in function SetMemoryPolicy>
# B3
B3: <built-in function SetSignalPolicy>
# B3
B3: <built-in function SetOwnership>
# B3
B3: <built-in function AddSmartPtrType>
# B3
B3: <built-in function InstallGUIEventInputHook>
# B3
B3: <built-in function RemoveGUIEventInputHook>
# B3
B3: <built-in function SetTypePinning>
# B3
B3: <built-in function IgnoreTypePinning>
# B3
B3: <built-in function Cast>
# B3
D2: <dict object at 0x7fbbe51dd730>
T4: <class '_pythonization.compose_method.<locals>.composition_pythonizor'>
Traceback (most recent call last):
  File "./test_dill.py", line 17, in <module>
    d = dill  .dumps( h )
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 294, in dumps
    dump(obj, file, protocol, byref, fmode, recurse)#, strictio)
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 287, in dump
    pik.dump(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 437, in dump
    self.save(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 637, in save_reduce
    save(func)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1064, in save_builtin_method
    pickler.save_reduce(_get_attr, (module, obj.__name__), obj=obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 638, in save_reduce
    save(args)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 774, in save_tuple
    save(element)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1269, in save_module
    state=_main_dict)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 890, in _batch_setitems
    save(v)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 819, in save_list
    self._batch_appends(obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 846, in _batch_appends
    save(tmp[0])
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 633, in save_reduce
    save(cls)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/dill/_dill.py", line 1330, in save_type
    StockPickler.save_global(pickler, obj)
  File "/cvmfs/sft.cern.ch/lcg/releases/LCG_97python3/Python/3.7.6/x86_64-centos7-gcc8-opt/lib/python3.7/pickle.py", line 960, in save_global
    (obj, module_name, name)) from None
_pickle.PicklingError: Can't pickle <class '_pythonization.compose_method.<locals>.composition_pythonizor'>: it's not found as _pythonization.compose_method.<locals>.composition_pythonizor

@VanyaBelyaev
Copy link
Author

and the script is:
[ibelyaev@lbcsrv01 TEST]$ cat test_dill.py
import ROOT
import dill
import pickle
import sys

print ('VERSIONS: ROOT & PYTHON: ', ROOT.gROOT.GetVersion() , sys.version_info )

dill.detect.trace(True)

h = ROOT.TH1D()

print ( 'PICKLE:' )
p = pickle.dumps( h )

print ( 'DILL:', dill.version )
d = dill .dumps( h )

print ( 'OK')

@mmckerns
Copy link
Member

Could you run the same script with debug settings for python2.7, as a comparison?

@VanyaBelyaev
Copy link
Author

VanyaBelyaev commented May 30, 2020

This is for python 2.7

[ibelyaev@lbcsrv01 build]$ python ./test_dill.py
('VERSIONS: ROOT & PYTHON: ', '6.20/02', sys.version_info(major=2, minor=7, micro=16, releaselevel='final', serial=0))
PICKLE:
B2: <built-in function _ObjectProxy__expand__>
# B2
('DILL:', '0.2.9')
B2: <built-in function _ObjectProxy__expand__>
# B2
OK

@mmckerns
Copy link
Member

mmckerns commented May 30, 2020

Oh, interesting. In python 2, dill punts the initial object to pickle's save_global, while in python 3, dill it uses the save_reduce method, with the recurse setting set to False. That's right off the bat, first thing. So, since, recurse is disabled there, you might just be able to use the byref=True setting in dump instead, which is meant to give you what pickle does.

@VanyaBelyaev
Copy link
Author

Thank you, Mike

With byref=True I see no changes with respect to default setting

@mmckerns
Copy link
Member

ROOT is a bit of an install just for debugging a compatibility issue, so I'm going to rely on you, as you can see above. I believe there's a workaround that you can use... it seems that h = ROOT.TH1D() produces a BuiltinMethodType object... and you can force picking with B2 if you set h.__self__ = None before picking. I'm not sure if that will break the object or not, but you might try it. If that doesn't work, then I think it would depend on some changes that I have coming (hopefully very) soon with better support for __qualname__.

@VanyaBelyaev
Copy link
Author

Hi Mike,

I can only agree that ROOT is indeed heavy (well, actually very heavy) stuff, and installing it for debugging purposes is not an easy action.
As for our particular case, setting h.__self__ = None does not change the behaviour.

@VanyaBelyaev
Copy link
Author

Hi Mike,

I have a minor update with newer version of dill 0.3.1,. but the problem is still here.

The script:

import ROOT
import dill
import pickle
import sys

print ('VERSIONS: ROOT & PYTHON: ', ROOT.gROOT.GetVersion() , sys.version_info )

dill.detect.trace(True)

h = ROOT.TH1D()

print ( 'PICKLE:' )
p = pickle.dumps( h )

print ( 'DILL:', dill.version )
d = dill .dumps( h )

print ( 'OK')

The output:

[ibelyaev@lbcsrv01 build]$ python ./test_dill.py
VERSIONS: ROOT & PYTHON: 6.23/01 sys.version_info(major=3, minor=7, micro=6, releaselevel='final', serial=0)
PICKLE:
DILL: 0.3.1
B3:
F2: <function _get_attr at 0x7fdfe35ee8c0>

F2

M1: <module 'libROOTPythonizations3_7' from '/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Mon/x86_64-centos7-gcc9-opt/lib/libROOTPythonizations3_7.so'>
F2: <function _import_module at 0x7fdfe35ee9e0>

F2

D2: <dict object at 0x7fdfe360e460>
T4: <class '_frozen_importlib.ModuleSpec'>

T4

D2: <dict object at 0x7fdff9a53aa0>
T4: <class '_frozen_importlib_external.ExtensionFileLoader'>

T4

D2: <dict object at 0x7fdff9a3caa0>

D2

D2

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

B3:

B3

TBufferFile::WriteObjectAny:0: RuntimeWarning: since TROOT has no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You will need to
add a default constructor before attempting to read it.
T4: <namespace cppyy.gbl.ROOT at 0x114651b0>

T4

D2

M1

B3

OK

This time I have a warning from ROOT:

TBufferFile::WriteObjectAny:0: RuntimeWarning: since TROOT has no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You will need to
add a default constructor before attempting to read it.

@vepadulano
Copy link

FYI this PR #382 fixes this issue:
With dill 0.3.2

vpadulan@fedorathinkpad-T550 [~]: python -m pip install dill==0.3.2
Defaulting to user installation because normal site-packages is not writeable
Collecting dill==0.3.2
  Downloading dill-0.3.2.zip (177 kB)
     |████████████████████████████████| 177 kB 762 kB/s 
Building wheels for collected packages: dill
  Building wheel for dill (setup.py) ... done
  Created wheel for dill: filename=dill-0.3.2-py3-none-any.whl size=78912 sha256=35e6366990c4e96b981d376a44de3e8f256a18b9b0250eacadd51602ad6740c4
  Stored in directory: /home/vpadulan/.cache/pip/wheels/93/7f/7d/78ec535a4340ef2696aad8b17fe8bb063d56301bd62881b069
Successfully built dill
Installing collected packages: dill
Successfully installed dill-0.3.2
vpadulan@fedorathinkpad-T550 [~]: python -c "import ROOT; import dill; print(type(dill.loads(dill.dumps(ROOT.TH1D()))))" 
TBufferFile::WriteObjectAny:0: RuntimeWarning: since TROOT has no public constructor
        which can be called without argument, objects of this class
        can not be read with the current library. You will need to
        add a default constructor before attempting to read it.
Error in <TClass::New>: cannot create object of class TROOT
Error in <TBufferFile::ReadObject>: could not create object of class TROOT
Error in <TSystem::TSystem>: only one instance of TSystem allowed
input_line_35:5:21: error: allocating an object of abstract class type 'TInterpreter'
         *ret = new TInterpreter;

With dill 0.3.3

vpadulan@fedorathinkpad-T550 [~]: python -m pip install dill==0.3.3
Defaulting to user installation because normal site-packages is not writeable
Collecting dill==0.3.3
  Using cached dill-0.3.3-py2.py3-none-any.whl (81 kB)
Installing collected packages: dill
Successfully installed dill-0.3.3
vpadulan@fedorathinkpad-T550 [~]: python -c "import ROOT; import dill; print(type(dill.loads(dill.dumps(ROOT.TH1D()))))" 
<class cppyy.gbl.TH1D at 0x55a5ffb3cd40>

@mmckerns
Copy link
Member

@vepadulano: thanks for the update. I'll close this. If this issue is found to persist, then please post here and I'll reopen.

@mmckerns mmckerns added this to the dill-0.3.4 milestone Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants