Install error: could not import python modules

When running the Rasa X install script, when the ansible playbook is executing, I’m getting the following error:

TASK [angstwad.docker_ubuntu : Ensure dirmngr is available] *******************************************************************************************************************************************************************************
 [WARNING]: Updating cache and auto-installing missing dependency: python3-apt

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not import python modules: apt, apt_pkg. Please install python3-apt package."}

I’ve confirmed that the python3-apt package is installed (this is Ubuntu 16.04). I’ve tried running uner python 3.6.9 & 3.7.4 and get the same result.

I find one strange message referencing python 2.7.12 at the beginning of the install. I’ve confirmed that update-alternatives has the python and python3 commands set to the 3.7.4 version by running the --version option.

greg@zbox:~/rasa/rasax$ sudo bash -x ./
Installing pip and ansible
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python is already the newest version (2.7.12-1~16.04).

Any solutions…

I had OS level Python issues which I resolved by setting up conda but you can also use venv or Docker to address this.

Do you have a more detailed description of how you fixed it? Step by step would be very useful and would help me a lot.