All of the script had been running perfectly fine in Jupyter Notebook. But, I am facing an issue "The kernel appears to have died. It will restart automatically" when I deploy python code using Jupyter Notebook on Azure. All parts of the code run fine, except for the last line of the code (where I open an image using OpenCV). Moreover, I have installed all necessary libraries. This is the error message that I am getting:
Kernel Restarting
The kernel appears to have died. It will restart automatically.
And, here is the skeleton of my Python Code:
!pip install opencv-python
!pip install numpy
!pip install tensorflow
!pip install -U numpy
!pip install ipykernel ipython jupyter_client jupyter_core traitlets ipython_genutils
!pip install numpy --upgrade
!pip install nomkl
!pip update --all
!apt-get update
!apt-get install ffmpeg libsm6 libxext6 -y
!pip install matplotlib
!pip install -c intel mkl
import cv2
image=cv2.imread('img_1.jpg')
image.shape
image[0]
import matplotlib.pyplot as plt
plt.imshow(image)
# from here I can get an error
while True:
cv2.imshow('Image',image)
if cv2.waitKey(2) == 27:
# 27 is ASCII os Escape
break
cv2.destroyAllWindows()
How do I solve this problem?
I checked some of the previous links on stackoverflow: Jupyter | The kernel appears to have died. It will restart automatically |
I tried the solution given in the link, unfortunately, it has not worked for my case :(