[IPython-User] Multiprocessing Pool woes

pbr tim.pierson@gmail....
Tue Feb 11 09:32:26 CST 2014

I've seen this problem reported on stackoverflow, but I can't seem to find a
solution.  (And I see that other IPython users don't seem to encounter it,
so I thought I'd ask).  I'm on windows 7 64 (32bit python 2.7.6) and the
following Multiprocessing Pool test returns a timeout error:

from multiprocessing import Pool

def f(x):
    return x*x

if __name__ == '__main__':
    pool = Pool(processes=4)              # start 4 worker processes
    result = pool.apply_async(f, [10])    # evaluate "f(10)" asynchronously
    print result.get(timeout=1)           # prints "100" unless your
computer is *very* slow
    print pool.map(f, range(10))          # prints "[0, 1, 4,..., 81]"

All other multiprocessing tests also throw errors (sometimes in console: 
running function f() writes: Attribute error "module" has to attribute 'f')

Is there a way to use multiprocessing on windows in ipython?

View this message in context: http://python.6.x6.nabble.com/Multiprocessing-Pool-woes-tp5047050.html
Sent from the IPython - User mailing list archive at Nabble.com.

More information about the IPython-User mailing list