-
Notifications
You must be signed in to change notification settings - Fork 409
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
TypeError: cannot pickle 'property' object #989
Comments
I'm running into the same issue, using the |
It looks like this is an issue with the from joblib import Parallel, delayed
class WithProperty:
@property
def foo(self):
return 'foo'
def __call__(self):
return self.foo
class WithoutProperty:
def bar(self):
return 'bar'
def __call__(self):
return self.bar()
# different backends
loky_backend = Parallel(n_jobs=2, backend='loky')
multiprocess = Parallel(n_jobs=2, backend='multiprocessing')
# create instances
with_property = WithProperty()
without_property = WithoutProperty()
# test
multiprocess([delayed(without_property)()]) # ok
multiprocess([delayed(with_property)()]) # ok
loky_backend([delayed(without_property)()]) # ok
loky_backend([delayed(with_property)()]) # broken |
FWIW I also checked whether import cloudpickle
class WithProperty:
@property
def foo(self):
return 'foo'
def __call__(self):
return self.foo
with_property = WithProperty()
cloudpickle.dumps(with_property) # ok |
Hi, thanks for the report.
FYI, That being said, the last The future joblib release will contain |
Thank you @pierreglaser I ran into this issue in the ray package, which also packages its own copy of I'm now having the same issue with Thanks again, |
I experience a problem with Python class properties and joblib. Somehow it is not possible to pickle them. See this minimal reproducible example:
This code fails raising
TypeError: cannot pickle 'property' object
. It works if you replace the property with a methodget_hello_world
and callself.get_hello_world()
inTask.run
.Environment:
The text was updated successfully, but these errors were encountered: