Skip to content

Error whith lambda function as argument #600

@cdancette

Description

@cdancette

Hi,

My environment : conda environment, python 3.5.4

I have the following bug :

from joblib import Parallel, delayed
a = lambda x: 2*x
def id(x):
    return x
Parallel(n_jobs=2)(delayed(id)(a) for x in range(10))

Which raises this error :

Traceback (most recent call last):
  File "/home/cdancette/anaconda3/envs/abnet3-bis/lib/python3.5/site-packages/joblib/externals/loky/backend/queues.py", line 150, in _feed
    obj, reducers=reducers)
  File "/home/cdancette/anaconda3/envs/abnet3-bis/lib/python3.5/site-packages/joblib/externals/loky/backend/reduction.py", line 145, in dumps
    p.dump(obj)
_pickle.PicklingError: Can't pickle <function <lambda> at 0x2aaab1f990d0>: attribute lookup <lambda> on __main__ failed

I tried with joblib version 0.11, and with the master version, and I have an error in both cases.

I read that lambda were supposed to be supported on master, do you know how I could fix this issue ?
Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions