python: pip install xmltodict fails

by diegus   Last Updated May 16, 2019 05:02 AM

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

Tags : python pip


Answers 2


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
diegus
diegus
June 22, 2016 08:17 AM

export LC_ALL=C

this will do the trick

Karthik
Karthik
May 16, 2019 04:15 AM

Related Questions


Updated April 08, 2017 08:02 AM

Updated January 27, 2017 14:00 PM

Updated September 20, 2018 12:02 PM

Updated June 26, 2017 22:02 PM