2

I would like to use Ansible on my ubuntu machine. I tried to use the ping module and it complains that it does not find the xmltodict python library. I thus wanted to install the missing module using pip. When I try:

pip install xmltodict

I get:

Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python2.7/locale.py", line 583, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

I am running Ubuntu16.04 LTS. How can I fiy this? thanks

3
  • 1
    See stackoverflow.com/q/36394101/486919.
    – edwinksl
    Jun 22, 2016 at 7:58
  • 1
    @edwinksl That actually solved my problem! Shell I post the solution here?
    – diegus
    Jun 22, 2016 at 8:06
  • Sure, remember to attribute the source appropriately though.
    – edwinksl
    Jun 22, 2016 at 8:07

2 Answers 2

4

The solution is here: https://stackoverflow.com/questions/36394101/pip-install-locale-error-unsupported-locale-setting

Since I am running python2.7:

$uname -a
Linux tools1-itigo-tech 4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$python --version
Python 2.7.11+
$unset LC_ALL
$pip install xmltodict
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python2.7/locale.py", line 583, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
$export LC_ALL=C
$pip install xmltodict
Collecting xmltodict
Downloading xmltodict-0.10.2.tar.gz
Building wheels for collected packages: xmltodict
Running setup.py bdist_wheel for xmltodict ... done
Stored in directory: /home/usr/.cache/pip/wheels/2a/dc/70/da8958d7089d994c8614bc38210f64855f09615e85707bf615
Successfully built xmltodict
Installing collected packages: xmltodict
Successfully installed xmltodict
1

export LC_ALL=C

this will do the trick

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .