python - joblib.Parallel running through spyder hanging on Windows -
i'm running python 3.5.1 on windows server 2013 @ work. have embarrassingly parallel tasks seem work on python 2.7 same code, unable figure out how run on python 3.5.1.
i'm using anaconda 2.4.1
the code looks this... i've stripped down minimum.
\ ->main.py \apackage\ ->__init__.py ->amodule.py
code main.py
from tpackage import aclass def go(): x = aclass().afunction() return x if __name__ == '__main__': x = go() print(x)
code __init__.py
from .amodule import aclass __all__ = ['aclass']
code amodule.py
from joblib import parallel, delayed class aclass(object): def afunction(self): x = parallel(n_jobs=2,verbose=100)( delayed(add1)(i) in range(10) ) return x def add1(x): return x + 1
does have need if __name__ == '__main__':
statement? didn't think need because parallel
protected inside def
statement , should run when __main__
module called, should happen once.
i should add if change n_jobs=1
in amodule.py
, works fine.
update:
so after further review, appears spyder. i'm using spyder 2.3.8. when have spyder execute dedicated window, works. when runs in interactive ipython console, fails. can run program directly command line without problems.
update 2:
after further review, has ipython being in different working directory *.py file. lined , works.
(spyder dev here) if problem caused runfile
setting working directory, can prevent happen going menu entry
run > configure
(or pressing f6) , unchecking working directory box.
note: run configuration saved each file , spyder remembers after restarts.
Comments
Post a Comment