I’m rather confused about how to setup and configure virtual environments in AWX. In order to support a dynamic inventory script which required Python3.6 (on AWX 3.0.1) I created a virtual environment as below.
yum install -y make gcc python36-devel
virtualenv /var/lib/awx/venv/cnd
source /var/lib/awx/venv/cnd/bin/activate
&& umask 0022
&& python3 -m pip install python-memcached psutil textfsm
&& python3 -m pip install -r /tmp/requirements36.txt
= requirements36.txt =
=2.1.1
=0.2.4
=2.2.0
urllib3>=1.24
=4.2.5
When I run the job template I get the error “ERROR! Unexpected Exception, this is probably a bug: psutil is missing; /var/lib/awx/venv/cnd/bin/pip install psutil”.
The job template is configured to use the created venv (cnd) as is the organization that contains it as well as the associated projects (for inventory sources and playbook) are configured in.
The cnd venv seems to contain psutil
← awxtask container →
[root@awx-dev-865f4cd88-9qjrz awx]# source /var/lib/awx/venv/cnd/bin/activate
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]# python2 -m pip install psutil
Requirement already satisfied (use --upgrade to upgrade): psutil in /usr/lib64/python2.7/site-packages
You are using pip version 8.1.2, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]# python3 -m pip install psutil
Requirement already satisfied: psutil in ./venv/cnd/lib/python3.6/site-packages (5.6.0)
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]#
← awxweb container →
[root@awx-dev-865f4cd88-9qjrz awx]# source /var/lib/awx/venv/cnd/bin/activate
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]# python2 -m pip install psutil
Requirement already satisfied (use --upgrade to upgrade): psutil in /usr/lib64/python2.7/site-packages
You are using pip version 8.1.2, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]# python3 -m pip install psutil
Requirement already satisfied: psutil in ./venv/cnd/lib/python3.6/site-packages (5.6.0)
(cnd) [root@awx-dev-865f4cd88-9qjrz awx]#
Any suggestions?