FS#70750 - [ansible] ansible --version returns: ImportError: cannot import name 'initialize_locale' from 'ansib

Attached to Project: Community Packages
Opened by Niklas E (snhy) - Friday, 07 May 2021, 17:56 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 08 May 2021, 12:19 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Trying to run ansible or ansible-playbook which returns:
Traceback (most recent call last):
File "/usr/bin/ansible", line 64, in <module>
from ansible.utils.display import Display, initialize_locale
ImportError: cannot import name 'initialize_locale' from 'ansible.utils.display' (/home/<user>/.local/lib/python3.9/site-packages/ansible/utils/display.py)

As stated below, system fully updated.

python --version
Python 3.9.4

Additional info:
* package version(s)
local/ansible 3.3.0-2
Official assortment of Ansible collections
* config and/or log files etc.
No special config
* link to upstream bug report, if any

Steps to reproduce:
Running ansible --version returns:
ansible --version
Traceback (most recent call last):
File "/usr/bin/ansible", line 64, in <module>
from ansible.utils.display import Display, initialize_locale
ImportError: cannot import name 'initialize_locale' from 'ansible.utils.display' (/home/<user>/.local/lib/python3.9/site-packages/ansible/utils/display.py)

Updated my system today (2021-05-07), fully updated.
Unable to find any google links that resolves this.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Saturday, 08 May 2021, 12:19 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#70749 

Don't do that again.
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 08 May 2021, 01:26 GMT
Can't reproduce, ansible --version behaves just as expected:

ansible --version
ansible [core 2.11.0]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/svenstaro/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/svenstaro/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.4 (default, Apr 20 2021, 15:51:38) [GCC 10.2.0]
jinja version = 2.11.3
libyaml = True
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 08 May 2021, 01:27 GMT
I'm pretty sure your system is broken in some way. Your ansible appears to be a local installation:

ImportError: cannot import name 'initialize_locale' from 'ansible.utils.display' (/home/<user>/.local/lib/python3.9/site-packages/ansible/utils/display.py)

Our package does nothing with .local/lib. Please check your system. See also output of `which ansible`.
Comment by Niklas E (snhy) - Saturday, 08 May 2021, 11:37 GMT
Managed to resolve this.
Cleaned up in .local/lib/python3.9/site-packages/ansible/
Probably caused by old modules that were out of date.

ansible --version
ansible [core 2.11.0]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/snhy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/snhy/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.4 (default, Apr 20 2021, 15:51:38) [GCC 10.2.0]
jinja version = 2.11.3
libyaml = True

All looks good now. Thanks Sven-Hendrik for pointing this out.
Fine to close this ticket.

Loading...