Ansible installation failing Python3 apt-pkg

I have the python module installed using python 3.7.9 and getting this error in the installation of ansible.

PLAY [Install edx_ansible] *****************************************************

TASK [Gathering Facts] *********************************************************
ok: []

TASK [server_utils : Check for expired edx key] ********************************
changed: []

TASK [server_utils : remove expired edx key] ***********************************
skipping: []

TASK [server_utils : Install ubuntu system packages] ***************************
fatal: []: FAILED! => {“changed”: false, “msg”: “Could not import python modules: apt, apt_pkg. Please install python3-apt package.”}
to retry, use: --limit @/tmp/configuration/playbooks/edx_ansible.retry

PLAY RECAP ********************************************************************* : ok=2 changed=1 unreachable=0 failed=1

The more information you can give us, the more we can help. What was the state of the machine before you started, and what commands did you run? What environment variables did you set?

No problem
unbuntu 16.04
set python version to python 3.7 9
pip set to pip3 alias pip-pip3
apt-pkg installed
config.yml set previously
set the open edxrelease as per the instructions

Dennis, help me out here. What can we do to make it clearer how to ask for help?

I don’t know what your description means. What is “set python version to python 3.7.9”, and why did you do that? What does “set the open edxrelease as per the instructions” mean? The instructions ask you to choose a branch, so I don’t know what branch you chose.


I updated python the release 3.7 then set the environment to use that version rather than 2.7 which comes as the base installation on unbuntu 16.04 =, this was done by using sudo update-alternatives set python /usr/bin/python3.7.

then set the edx version to juniper.3 by the `export OPENEDX_RELEASE=open-release/juniper.3 command

Does that help you?

Thanks. You shouldn’t change the Python version. The instructions will work on a 16.04 box as they are. For the version, use “open-release/juniper.master”, since there have been fixes since .3.


Thanks Ned I will try that and let you know how I get on