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!
The example notebook works well for me with SageMath 10.5 running on Ubuntu 24.04. Which version of Sage are you using and what is your operating system?
I'm using sage version 10.2 on Ubuntu 22.04 WSL on Windows 11. I will try to restart the kernel and re-run all the code again to check what is going wrong.