python - Jupyter notebook dead kernal - TagMerge
3Jupyter notebook dead kernalJupyter notebook dead kernal

Jupyter notebook dead kernal

Asked 1 years ago
3 answers

It seems conda has not installed properly in your system. Try again by uninstalling the anaconda and install it back from scratch.

Please check this link to install Anaconda.

After installing Anaconda in your system, Create virtual environment to install Tensorflow in it as below:

To install the current release of CPU-only TensorFlow,

conda create -n tf tensorflow
conda activate tf

Or, to install the current release of GPU TensorFlow

conda create -n tf-gpu tensorflow-gpu
conda activate tf-gpu

You can also create virtual environment in Anaconda Environment section. Open the Jupyter notebook by selecting the same virtual environment.

run below code:

conda install pip
pip install tensorflow

After doing all these setups, your code may run fine as I have already executed above code in Jupyter and its not showing any error.

Source: link


$ jupyter kernelspec list
Available kernels:
  python3      /home/takluyver/.local/lib/python3.6/site-packages/ipykernel/resources
  bash         /home/takluyver/.local/share/jupyter/kernels/bash
  ir           /home/takluyver/.local/share/jupyter/kernels/ir
File "c:\users\jovyan\python\myenv.venv\lib\site-packages\jupyter_core\", line 424, in secure_write
File "c:\users\jovyan\python\myenv.venv\lib\site-packages\jupyter_core\", line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: The specified module could not be found.
File "C:\Users\jovyan\AppData\Roaming\Python\Python37\site-packages\jupyter_core\", line 435, in secure_write
File "C:\Users\jovyan\AppData\Roaming\Python\Python37\site-packages\jupyter_core\", line 361, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: %1 is not a valid Win32 application
pip install --upgrade pywin32
conda install --force-reinstall pywin32

Source: link


Here is the annotated sample code that the tutorial offers:
import matplotlib.pyplot as plt

# Pie chart, where the slices will be ordered and plotted counter-clockwise:
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')

fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
        shadow=True, startangle=90)
ax1.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
Thank you. I think I figured it out. First I took your advice and printed a "Hello World", which went fine. After that, I tried importing matplotlib by itself with
import matplotlib.pyplot as plt
One last time, I attempted the same process of uninstalling and reinstalling everything with the added step of clearing my conda cashe using
conda clean -tipsy
In the terminal I noticed a failure message:
[I 03:19:38.200 NotebookApp] Kernel started: 91f08d87-45fe-4f39-8a64-cc77e1a727ee, name: python3
INTEL MKL ERROR: /opt/miniconda3/lib/python3.8/site-packages/mkl/../../../ invalid ELF header.
Intel MKL FATAL ERROR: Cannot load
The Intel Distribution for Python (IDP) is their Math Kernel Library, which evidently was having an issue loading. It was here that I deemed the problem to be sufficiently diagnosed, and then installed the IDP with this command:
conda create -n idp intelpython3_full python=3

Source: link

Recent Questions on python

    Programming Languages