Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have Ansible tower with 3.5 on RHEL 7.6 with the following setup:
- # python -V
- Python 2.7.5
- # ansible --version
- ansible 2.7.6
- config file = /etc/ansible/ansible.cfg
- configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
- ansible python module location = /usr/lib/python2.7/site-packages/ansible
- executable location = /usr/bin/ansible
- python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
- # pip freeze
- DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple ase upgrade your Python as Python 2.7 won't be maintained after that date. A fut ure version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/relea se-process/#python-2-support
- ansible==2.7.6
- Babel==0.9.6
- backports.ssl-match-hostname==3.5.0.1
- cffi==1.6.0
- chardet==2.2.1
- configobj==4.7.2
- cryptography==1.7.2
- decorator==3.4.0
- dnspython==1.12.0
- enum34==1.0.4
- ethtool==0.8
- futures==3.1.1
- httplib2==0.9.2
- idna==2.4
- iniparse==0.4
- insights-client==3.0.6
- ipaddr==2.1.11
- ipaddress==1.0.16
- javapackages==1.0.0
- Jinja2==2.8
- jmespath==0.9.0
- kitchen==1.1.1
- lxml==3.2.1
- M2Crypto==0.21.1
- Magic-file-extensions==0.2
- MarkupSafe==0.11
- meld3==0.6.10
- mercurial==2.6.2
- paramiko==2.1.1
- pciutils==1.7.3
- perf==0.1
- ply==3.4
- psycopg2==2.7.5
- pyasn1==0.1.9
- pycparser==2.14
- pycrypto==2.6.1
- pycurl==7.19.0
- pygobject==3.22.0
- pygpgme==0.3
- pyinotify==0.9.4
- pyliblzma==0.5.3
- pyOpenSSL==0.13.1
- python-dateutil==1.5
- python-dmidecode==3.10.13
- python-keyczar==0.71rc0
- python-linux-procfs==0.4.9
- python-qpid-proton==0.24.0
- pyudev==0.15
- pyxattr==0.5.1
- PyYAML==3.10
- requests==2.6.0
- rhnlib==2.5.65
- schedutils==0.4
- six==1.9.0
- slip==0.4.0
- slip.dbus==0.4.0
- subscription-manager==1.24.13
- supervisor==3.1.4
- syspurpose==1.24.13
- urlgrabber==3.10
- urllib3==1.10.2
- virtualenv==15.1.0
- yum-metadata-parser==1.1.4
- And I have created a virtual environment as follow:
- # yum install gcc openssl-devel libffi-devel python-devel
- # yum install python27
- # scl enable python27 bash
- # umask 0022
- # mkdir /opt/new/custom-venv
- # chmod 0755 /opt/new/
- # virtualenv /opt/new/custom-venv --python=python2.7
- # source /opt/new/custom-venv/bin/activate
- (custom-venv)# /opt/new/custom-venv/bin/pip setuptools --upgrade
- (custom-venv)# /opt/new/custom-venv/bin/pip install --upgrade pip
- (custom-venv)# /opt/new/custom-venv/bin/pip install python-memcached psutil ansible==2.8.4
- (custom-venv)# /opt/new/custom-venv/bin/pip ovirt-engine-sdk-python==4.3.0
- (custom-venv)# /opt/new/custom-venv/bin/pip install hpICsp==1.0.2
- (custom-venv)# /opt/new/custom-venv/bin/pip install hpOneView==4.8.0
- (custom-venv)# rsync -avh --progress /tmp/oneview/library /opt/new/custom-venv/lib/python2.7/site-packages/ansible/oneview-ansible
- (custom-venv)# pip freeze
- DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
- ansible==2.8.4
- cffi==1.13.2
- cryptography==2.8
- enum34==1.1.6
- future==0.18.2
- hpICsp==1.0.2
- hpOneView==4.8.0
- ipaddress==1.0.23
- Jinja2==2.10.3
- MarkupSafe==1.1.1
- ovirt-engine-sdk-python==4.3.0
- psutil==5.6.5
- pycparser==2.19
- pycurl==7.43.0.3
- python-memcached==1.59
- PyYAML==5.1.2
- six==1.13.0
- (custom-venv)# python -V
- Python 2.7.16
- And from the UI Settings-> Systems I have adjusted the virtual environment to point to /opt/new
- Now when I run any Job, I am getting the following error :
- Traceback (most recent call last):
- File "/opt/new/custom-venv/bin/ansible-playbook", line 60, in
- import ansible.constants as C
- File "/opt/new/custom-venv/lib/python2.7/site-packages/ansible/constants.py", line 12, in
- from jinja2 import Template
- File "/opt/new/custom-venv/lib/python2.7/site-packages/jinja2/init.py", line 33, in
- from jinja2.environment import Environment, Template
- File "/opt/new/custom-venv/lib/python2.7/site-packages/jinja2/environment.py", line 13, in
- import weakref
- File "/opt/rh/python27/root/usr/lib64/python2.7/weakref.py", line 14, in
- from _weakref import (
- ImportError: cannot import name _remove_dead_weakref
- How can I fix it so I can run jobs using the virtual environment?
Add Comment
Please, Sign In to add comment