pythonimportcrashkernelpython-xarray

Jupyter notebook kernel crashes when importing xarray


I'm trying to import xarray in my Jupyter Notebook and when I run the cell

import xarray

the following error appears: "The Kernel crashed while executing code in the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details."

I have tried restarting the kernel several times, uninstalling and reinstalling xarray and even increasing my memory by adding the cell

import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

before the import but none of it has worked. I foun online that it is also possible other dependent packages could cause the package to fall over, and they suggest to start a new environment. Is there a way to solve it without starting a new environment?


Solution

  • After trying everything I found online, I solved it. None of the methods for increasing the RAM limits for Jupyter Notebook were working. However I installed xarray with conda, i.e, conda install "xarray[complete]" it works. Apparently, this has to do with some prerequisites of the xarray module. Before, I was installing it with pip install "xarray[complete]".