I had a lot of trouble installing the Python TensorFlow libs required for object detection in Ubuntu - then I wrote a script that works for me and my collaborators (Ubuntu 20.04 and 21.04):

Python TensorFlow Object Detection installation

It installs all the system prerequisites (like protobuf), CUDA, the python libs, and also downloads one neural network (because I worked with it).

The crucial part is this:

pip3 install pycocotools --no-build-isolation --no-binary :all:

Apparently there is a pip bug that without the additional flags makes it installing binaries for numpy 1.20.xx and then linking pycocotools with it: from this SO answer

None of the online tutorials I found touched this problem. Maybe it will be fixed some day.