Unable to install package packages due to locale.error inside Ubuntu Vagrant Box

I just created a stray box with ubuntu / trusty32. A stray assistant during the creation of the box did the following:

  • Download source tarball with python virtual server using wget
  • unpacked the tarventenv archive using tar zxvf ./virtualenv.tar.gz
  • created virtualenv named venv using python ./virtualenv/virtualenv.py ./venv
  • launched the newly created venv using source ./venv/bin/activate
  • installed several package packages with pip install django , pip install mysqlclient , etc. inside a virtual environment.

All this worked perfectly and perfectly - performed by a wandering assistant when creating a wandering box for the first time.

However, later I logged in to the ssh firewall and tried to install ipython via pip .

 $ vagrant ssh vagrant@django-box :~$ source venv/bin/activate (venv) vagrant@django-box :~$ pip install ipython Traceback (most recent call last): File "/home/vagrant/venv/bin/pip", line 11, in <module> sys.exit(main()) File "/home/vagrant/venv/local/lib/python2.7/site-packages/pip/__init__.py", line 215, in main locale.setlocale(locale.LC_ALL, '') File "/home/vagrant/venv/lib/python2.7/locale.py", line 579, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting (venv) vagrant@django-box :~$ 

Note: this is a new new stray box launched by ubuntu / trusty32 out of the box.

There are a few SO questions about the locale error, but after them there was no help for this roaming scenario.

It does not make sense that all this worked perfectly during the creation / creation of the firewall, but did not subsequently work when trying to do the same thing manually .

+6
source share
1 answer

First check the current locale configuration by simply placing locale on the command line.

You should see something similar to:

 locale: Cannot set LC_CTYPE to default locale: No such file or directory LANG=C LC_CTYPE=utf8 

Set a valid language in the LC_CTYPE environment variable by running the following commands:

 export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 export LC_CTYPE="en_US.UTF-8" locale-gen en_US.UTF-8 sudo dpkg-reconfigure locales 

PS. en_US.UTF-8 used here, but if you need to check all available locales on your system, run the locale -a command

This should solve the problem.

+15
source

All Articles