science_concierge icon indicating copy to clipboard operation
science_concierge copied to clipboard

Can't pickle <type 'instancemethod'> when using python's multiprocessing Pool.map()

Open titipata opened this issue 9 years ago • 4 comments

This error found by @bluenex and related to this Stack overflow post.

titipata avatar May 14 '16 15:05 titipata

Good catch! I think I had the same error once. When does this happen?

daniel-acuna avatar May 14 '16 15:05 daniel-acuna

When using python 2.7. People in Stack Overflow suggested to use pathos.

titipata avatar May 14 '16 15:05 titipata

I would go with pathos. Where are you getting the error? Can you share code to reproduce the error?

daniel-acuna avatar May 14 '16 16:05 daniel-acuna

Here is code that gives error. Note that I do a quick fix in 50f7019ee844a65719a1

from science_concierge import preprocess
from multiprocessing import Pool

df = pd.read_csv('pubmed_oa_2016.csv')
docs = list(df.abstract)
pool = Pool()
docs_preprocess = pool.map(preprocess, docs)

This error is gone after I installed pathos i.e.

pip install git+https://github.com/uqfoundation/pathos.git@master

titipata avatar May 14 '16 16:05 titipata