Friday, 29 March 2019

Cannot import PyOpenCL in Juypter Notebook

I'm running inside an anacoda environment with pyopencl installed:

$> conda list | grep pyopencl
pyopencl                  2018.2.5         py37h9888f84_0    conda-forge

And from that same window I launch:

$> anaconda3/bin/jupyter_mac.command

Which is:

cat /Anaconda3/bin/jupyter_mac.command

DIR=$(dirname $0)

$DIR/jupyter-notebook

So, now we're running a notebook. When I attempt to import pyopencl:

import pyopencl as cl

I get the following error:

ModuleNotFoundError: No module named 'pyopencl'

I am able to run the examples locally in the same shell w/out any errors via:

$> python test6.py
Choose platform:
[0] <pyopencl.Platform 'Portable Computing Language' at 0x11512cf00>
[1] <pyopencl.Platform 'Apple' at 0x7f984cd1e010>
Choice [0]:1
Choose device(s):
[0] <pyopencl.Device 'Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz' on 'Apple' at 0x7f984cc1f090>
[1] <pyopencl.Device 'Intel(R) UHD Graphics 630' on 'Apple' at 0x7f984cc19370>
[2] <pyopencl.Device 'AMD Radeon Pro 560X Compute Engine' on 'Apple' at 0x7f984cc19390>
Choice, comma-separated [0]:2
Set the environment variable PYOPENCL_CTX='1:2' to avoid being asked again.
PASSED
[-0.13433748]
[-0.13433748]

Any help is appreciated! Thanks.



from Cannot import PyOpenCL in Juypter Notebook

No comments:

Post a Comment