Can’t import numpy from an installed jupyter kernel

Viewed 702

I have jupyterlab installed in my base conda env. Now, I created another evn and installed its kernel using kernelspec. But, when I attach a notebook to this kernel and try to import numpy, I get DLL load failed while importing _multiarray_umath error.

Steps to reproduce the error:

  1. Install jupyterlab in base env(do not install numpy in it, just have jupyterlab)

  2. Create a new env with numpy in it.

  3. Activate this env.

  4. Install its kernel with the command “python -m ipykernel install --user --name env_name --display-name env_display_name”

  5. Open jupyterlab and attach a notebook to this kernel

  6. import numpy

When I install numpy in base env along with jupyterlab, I am able to import numpy from the installed kernel (the same version of numpy as in the installed kernel). But, I don’t think this is a fix more like a hacky way(which I don’t know why it works).

I would really appreciate any help. I have face the same issue in jupyter-lab as well as classic notebook. I have attached a screenshot below for reference.

Screen shot consisting kernel name(SPN) and the error

2 Answers

I figured it out, I just had to set "CONDA_DLL_SEARCH_MODIFICATION_ENABLE" env variable in the kernel.json as mentioned in Conda Troubleshooting

I think you need to install conda from the anaconda prompt use these commands :

conda update conda 

conda install numpy
Related