"the kernel appears to have died": Problems using Tensorflow2 on a Ubuntu 21.04 desktop

hello, I am new here in the forum. I am a retired analyst who tinkers with Python, Tensorflow, PyTorch etc. I have an older Dell Optiplex 760 desktop which I use for some of my ML exercises. Running TF and TF2 on the Ubuntu 20.04 desktop there was non problems, how when I upgraded from Ubuntu 20.04 to Ubuntu 21.04, none of my Python scripts with TF2 would work. as soon as the script tried to run “Import Tensorflow as tf” , I would get the message “the kernel appears to have died, it will restart automatically”.

While its an older computer with 4 megs of ram, the same scripts ran very well on a Ubuntu 20.04 machine with the same specs. I thought that I would ask the question here in case anyone had similar experiences.

I look forward to any responses

Clive DaSilva

2 Likes

You could try to use one of the official docker tensorflow images to see if it solves your problem.

2 Likes

Can you post the full error message please? Also, maybe a minimal code that reproduces the problem?

1 Like

Hi @Clive_Dasilva Welcome to the forum.

+1. What @mihaimaruseac suggested can help reproduce the error and potentially find a solution. A list of steps with conda/pip commands you took to install TensorFlow and other packages could help.

In addition, as you’re probably aware, Python packages can be tricky. Some users appear to have experienced a similar issue - e.g. Kernel Restarting The kernel appears to have died. It will restart automatically (Jupyter-Tensorflow) · Issue #9829 · tensorflow/tensorflow · GitHub - and some have come up with possible solutions, such as updating a certain package.

Since you’re on Linux, you could try Docker (as @Aure suggested) or venv (a virtual environment) to isolate TensorFlow from the rest of the Python packages, then install tensorflow and maybe jupyterlab and see if that fixes your issue.

Let us know how it goes.


(:slight_smile: from xkcd: Python Environment)

3 Likes

Thanks, I’ll try the venv route as suggested. set up a venv just for tf and see how it works. Damn thing is I have an older laptop running Ubuntu 20.04 with Tensorflow 2.2.9 and it works without this issue

2 Likes

I meant Tensorflow 2.2.0

1 Like