ubuntu: openstack can not be executed on the terminal: change all occurrences of "import gobject" to "from gi.repository import GObject"

I installed successfully OpenStack DevStack in Ubuntu 18.04 LTS following the standard procedure at – https://docs.openstack.org/devstack/latest/

However, when writing to the terminal:

sudo openstack 

The following exception arises:

Generated exception: when using gi.repository, you should not import static
Modules as "gobject". Please change all the occurrences of "import
gobject "to" from gi.repository import GObject. "See:

Does anyone know how to make this work?

I have been trying different tricks and none of them is working. Please, do not mark this question as off topic because is a programming question, since its objective is to solve a common problem in order to allow the user to develop applications in an OpenStack environment.