Error importing tensorflow after upgrade to v2

import tensorflow as tf
[libprotobuf FATAL google/protobuf/stubs/common.cc:86] This program was compiled against version 3.7.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.8.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in “bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.cc”.)
terminate called after throwing an instance of ‘google::protobuf::FatalException’
what(): This program was compiled against version 3.7.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.8.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in “bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.cc”.)
Aborted (core dumped)

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.