Error importing tensorflow after upgrade to v2

Run the following to remove all packages installed via pip, and revert back to the Python packages installed by Lambda Stack:

sudo rm -rf {~/.local,/usr/local}/{bin/pip,lib/python}*

You should then be able to import tensorflow successfully.

For Tensorflow 2, you’re going to want to upgrade to Ubuntu 20.04.