Pickling error with multiprocessing    
   Good morning all. I'm trying to run a test example of multiprocessing in SageMath 10.3 on Jupyter. I get an error saying that the lookup for the function "task" failed. I'm a bit new to this, and am wondering where I'm going wrong. Is there a package I forgot to install or something? Thanks. Eric
reset()
from random import random
from time import sleep
from multiprocessing.pool import Pool
def task(identifier):
    # generate a value
    value = random()
    # report a message
    print(f'Task {identifier} executing with {value}', flush=True)
    # block for a moment
    sleep(value)
    # return the generated value
    return value
def eric():
    # create and configure the process pool
    with Pool() as pool:
        # execute tasks in order, process results out of order
        for result in pool.imap_unordered(task, range(50)):
            print(f'Got result: {result}', flush=True)
eric()
 PicklingError: Can't pickle <function task="" at="" 0x15676bc40="">: attribute lookup task on sage.all_cmdline failed
 
Your code works fine in Sagecell
How do you run your code?
In doing a bit more research, I found that the pickling problem is with the "multiprocessing" package in Sage. This does not work on MacOS. An improved package, called "multiprocess", is available. I've installed this in my python environment, but can't seem to access it from Sage. As I understand things, Sage uses it's own python, and does not recognize the newly installed multiprocess.
Question: how do I import multiprocess into SageMath? I tried the command (from Jupyter running Sage 10.3):
pip install multiprocess
but this gives a syntax error at the word "install"
Thanks for any guidance Eric
I run it on OSX from Anaconda Navigator. From there I launch JupyterLab and select the SageMath 10.3 kernel for my notebook.
Have you tried to use built-in Sage's parallel computing functionality? https://doc.sagemath.org/html/en/refe...