Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error occuring in multiprocessing.Pool()

I'm trying to learn multiprocessing in SageMath and I picked this wonderful example notebook to try things out. I have been working out and playing with things step by step and I tried the multiprocessing part today.

I defined the following part, exactly as defined in the notebook,

display(f)
pool = multiprocessing.Pool(n_cpu)
for i, some_res in enumerate(pool.imap_unordered(calc_some_geodesics, args)): # do and wait
    # progress bar update
    f.value += len(some_res)
    # update result
    geo.update(some_res)

# clean exit
pool.close()
pool.join()

But when I run this, it gives me the following error,

MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x7fd960bdf400>'. Reason: 'TypeError("cannot pickle 'sage.cpython.getattr.AttributeErrorMessage' object")'

I surfed through the web and I am seeing some ways of fixing this error but I'm not sure how to do it in my case. Any help to resolve this error would be really great, Cheers!

Error occuring in multiprocessing.Pool()

I'm trying to learn multiprocessing in SageMath and I picked this wonderful example notebook to try things out. I have been working out and playing with things step by step and I tried the multiprocessing part today.

I defined the following part, exactly as defined in the notebook,

display(f)
pool = multiprocessing.Pool(n_cpu)
for i, some_res in enumerate(pool.imap_unordered(calc_some_geodesics, args)): # do and wait
    # progress bar update
    f.value += len(some_res)
    # update result
    geo.update(some_res)

# clean exit
pool.close()
pool.join()

But when I run this, it gives me the following error,

MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x7fd960bdf400>'. Reason: 'TypeError("cannot pickle 'sage.cpython.getattr.AttributeErrorMessage' object")'

I surfed through the web and I am seeing some ways of fixing this error but I'm not sure how to do it in my case. Any help to resolve this error would be really great, Cheers!

Edit: I also found a couple of other forum questions (this one,and this one) all related to the same multiprocessing module in the same notebook, is it something that cannot be fixed? Please guide me, cheers!