I want to run a simple code in the IJulia notebook which uses the python library numpy. I call numpy with PyCall:
using PyCall
@pyimport numpy as np
This works fine. I then want to split this up to several processors. I add the processors:
addprocs(4)
Then, I run N/proc iterations for a function f, where proc is my number of processors. I split the load evenly between the four processors on my computer:
n=round(Int,N/proc); proc_sum = @parallel (+) for i=1:proc f(n) end return proc_sum / proc
Without numpy, this works fine. However, when I try to split the code with numpy to different processors, I get the error
ERROR (unhandled task failure): On worker 3:
UndefVarError: np not defined
Is there any way to have numpy work on the other processors? Note that I have Julia 0.5.2, and I have Canopy. I know there have been issues reported before with PyCall and Canopy, but I would greatly prefer keeping Canopy on my machine.