Problem with importing monai

hello everybody
I’m trying to use monai but when I import it this error shows up.
“The kernel appears to have died. It will restart automatically.”

I have installed it using pip install monai. and I’m using python 3.9.12.

when I use jupyter notebook extension in VS code this error shows up.
“Canceled future for execute_request message before replies were done
The Kernel crashed while executing code in the 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.”

this happens even when I just write “import monai”

Try to run the import monai code snippet in a terminal and check if a better error message would be raised. Also, please create a GitHub issue with instructions how to reproduce it in the MONAI repository so the developers can take a look at it.

Hi ptrblck thank for your answare.
I did it and this error showed up.
“>>> import monai
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see Intel® Product Support

I used this code and it almost fixed.
(import os
os.environ[‘KMP_DUPLICATE_LIB_OK’]=‘True’
import monai

'Failed to load image Python extension: [WinError 127] The specified procedure could not be found ’ )

I say almost fixed because although monai is imported, a message shows up, 'Failed to load image Python… ’
Furthermore, the last line of the previous error says" that may cause crashes or silently produce incorrect results. "

This warning is raised by torchvision.io and you should be able to ignore it unless you need to use the serialization support from this namespace.

I agree that this sounds quite dangerous so I would probably try to properly fix your setup.