# python error during task

**URL:** <https://forum.ansible.com/t/python-error-during-task/36889>\
**Category:** Ansible Developer\
**Created:** [July 22, 2022, 6:25pm UTC](https://forum.ansible.com/t/python-error-during-task/36889 "2022-07-22T18:25:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiDomenico\_Michael\_A](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@DiDomenico\_Michael\_A](https://forum.ansible.com/u/DiDomenico_Michael_A)\
**Post date:** [July 22, 2022, 6:25pm UTC](https://forum.ansible.com/t/python-error-during-task/36889/1 "2022-07-22T18:25:02Z")

</div>

i have compiled a separate version of openssl 1.1.1, python 3.10.5, and ansible 2.13.2 into my home directory. i have the interpreter\_python set in the ansible.cfg file to point to the version of python in my home directory.

on some hosts my playbook runs okay, but on others i'm getting the below error. what i think the problem is, is that python is finding modules in the 2.7 system libs on particular hosts and not others. on the hosts that work i'm guessing python isn't picking up the 2.7 system lib versions

i'm new to ansible and python, so i'm not sure where the error lies. i'm hedging a bet, it's in the way i compiled python in my home directory. it happened when i pip installed ansible with my custom python. but i'm not sure which or how exactly to debug this dependency issue

TASK [install ntpd if missing] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /home1/user/ansible\_ccm/playbooks/ntpd/main.yml:15  
Friday 22 July 2022 11:10:46 -0700 (0:00:01.705) 0:00:01.731 \*\*\*\*\*\*\*\*\*\*\*  
Friday 22 July 2022 11:10:46 -0700 (0:00:01.706) 0:00:01.730 \*\*\*\*\*\*\*\*\*\*\*  
Running ansible.legacy.yum  
Using module file /u/user/ansible/lib/python3.10/site-packages/ansible/modules/yum.py  
Pipelining is enabled.  
\<host1\> ESTABLISH LOCAL CONNECTION FOR USER: root  
\<host1\> EXEC /bin/sh -c 'PYTHONPATH=/u/user/ansible/lib/python3.10/site-packages/:/u/mdidome1/ansible/lib64/python3.10/site-packages/ LD\_LIBRARY\_PATH=/u/user/ansible/lib:/u/user/ansible/lib64 /u/user/ansible/bin/python3.10 && sleep 0'  
The full traceback is:  
Traceback (most recent call last):  
&nbsp;&nbsp;File "\<stdin\>", line 16, in \<module\>  
&nbsp;&nbsp;File "/usr/lib64/python2.7/runpy.py", line 176, in run\_module  
&nbsp;&nbsp;&nbsp;&nbsp;fname, loader, pkg\_name)  
&nbsp;&nbsp;File "/usr/lib64/python2.7/runpy.py", line 82, in \_run\_module\_code  
&nbsp;&nbsp;&nbsp;&nbsp;mod\_name, mod\_fname, mod\_loader, pkg\_name)  
&nbsp;&nbsp;File "/usr/lib64/python2.7/runpy.py", line 72, in \_run\_code  
&nbsp;&nbsp;&nbsp;&nbsp;exec code in run\_globals  
&nbsp;&nbsp;File "/tmp/ansible\_ansible.legacy.yum\_payload\_aa9h7s\_4/ansible\_ansible.legacy.yum\_payload.zip/ansible/modules/yum.py", line 405, in \<module\>  
&nbsp;&nbsp;File "/tmp/ansible\_ansible.legacy.yum\_payload\_aa9h7s\_4/ansible\_ansible.legacy.yum\_payload.zip/ansible/module\_utils/urls.py", line 116, in \<module\>  
&nbsp;&nbsp;File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 46, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;import OpenSSL.SSL  
&nbsp;&nbsp;File "/usr/lib/python2.7/site-packages/OpenSSL/\_\_init\_\_.py", line 8, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;from OpenSSL import rand, crypto, SSL  
&nbsp;&nbsp;File "/usr/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;from OpenSSL.\_util import (  
&nbsp;&nbsp;File "/usr/lib/python2.7/site-packages/OpenSSL/\_util.py", line 6, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;from cryptography.hazmat.bindings.openssl.binding import Binding  
&nbsp;&nbsp;File "/u/user/ansible/lib/python3.10/site-packages/cryptography/\_\_init\_\_.py", line 13, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;from cryptography.utils import CryptographyDeprecationWarning  
&nbsp;&nbsp;File "/u/user/ansible/lib/python3.10/site-packages/cryptography/utils.py", line 30  
&nbsp;&nbsp;&nbsp;&nbsp;def \_check\_bytes(name: str, value: bytes) -\> None:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
SyntaxError: invalid syntax
