I try the hello-world example as follows of multiprocessing in Jupyterlab and it hangs forever, and I Googled and tried different ways still no luck, please help and advise, thanks in advance.
from multiprocessing import Pool
def f(x):
return x*x
if name == ‘main’:
with Pool(5) as p:
print(p.map(f, [1, 2, 3]))
In that post referenced with the answer is a subtle variation approach using a temporary file that is made in more of a programmatic manner, too. Still another, lower-scoring answer there says it isn’t supported, which maybe is why you have to expect to jump through some hoops to use it in Windows. The fact that the other options score higher makes me think if you go through the extra steps, you can indeed get it working on Windows. (I have not tested it though on Windows myself.)
For pasting code in so it is readable in forums such as this, you’ll want to learn about ‘block code formatting’ here. (Or see about ‘fenced code blocks’ here. They are both the same thing if you look into the details. They just have slightly different terms used in the two locations.)
And a good practice is to always open a new notebook with a fresh kernel and run the minimal reproducible example you supply before hitting ‘post’. Represent accurately what you tried and help those trying to help you.