poise / python

THIS COOKBOOK IS DEPRECATED – Chef cookbook to install Python and related tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pip install error which doesn't happen manually (Python3)

chescales opened this issue · comments

Let me put you in context:

  • Ubuntu 14.04
  • Vagrant 1.6.3
  • VirtualBox 4.3.10
  • Chef Development Kit Version: 0.2.0

I am trying to set up a Vagrant machine with Ubuntu 14.04 too, with mysql, python3, django, and some dependencies, among which is django-countries. I have created a VagrantFile which provisions my Ubuntu with a recipe that installs all my packages and then runs the python recipe.

The problem comes when running the following resource on Chef:

python_pip "/vagrant/requirements.txt" do
    user "vagrant"
    virtualenv "/home/vagrant/devenv"
    options "-r"
end

Shows the following output:

==> default: [2014-08-08T12:11:42+00:00] ERROR: Running exception handlers
==> default: [2014-08-08T12:11:42+00:00] ERROR: Exception handlers complete
==> default: [2014-08-08T12:11:42+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-08-08T12:11:42+00:00] ERROR: python_pip[/vagrant/requirements.txt] (provision::sql-db line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt ----
==> default: STDOUT: Downloading/unpacking django-countries==2.1.2 (from -r /vagrant/requirements.txt (line 20))
==> default:   Running setup.py (path:/home/vagrant/devenv/build/django-countries/setup.py) egg_info for package django-countries
==> default:     Traceback (most recent call last):
==> default:       File "<string>", line 17, in <module>
==> default:       File "/home/vagrant/devenv/build/django-countries/setup.py", line 23, in <module>
==> default:         long_description=long_description(),
==> default:       File "/home/vagrant/devenv/build/django-countries/setup.py", line 14, in long_description
==> default:         return readme.read()
==> default:       File "/home/vagrant/devenv/lib/python3.4/encodings/ascii.py", line 26, in decode
==> default:         return codecs.ascii_decode(input, self.errors)[0]
==> default:     UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1941: ordinal not in range(128)
==> default:     Complete output from command python setup.py egg_info:
==> default:     Traceback (most recent call last):
==> default: 
==> default:   File "<string>", line 17, in <module>
==> default: 
==> default:   File "/home/vagrant/devenv/build/django-countries/setup.py", line 23, in <module>
==> default: 
==> default:     long_description=long_description(),
==> default: 
==> default:   File "/home/vagrant/devenv/build/django-countries/setup.py", line 14, in long_description
==> default: 
==> default:     return readme.read()
==> default: 
==> default:   File "/home/vagrant/devenv/lib/python3.4/encodings/ascii.py", line 26, in decode
==> default: 
==> default:     return codecs.ascii_decode(input, self.errors)[0]
==> default: 
==> default: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1941: ordinal not in range(128)
==> default: 
==> default: ----------------------------------------
==> default: Cleaning up...
==> default: Command python setup.py egg_info failed with error code 1 in /home/vagrant/devenv/build/django-countries
==> default: Storing debug log for failure in /home/vagrant/.pip/pip.log
==> default: STDERR: 
==> default: ---- End output of /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt ----
==> default: Ran /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt returned 1
==> default: 
==> default: ================================================================================
==> default: Error executing action `install` on resource 'python_pip[/vagrant/requirements.txt]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt ----
==> default: STDOUT: Downloading/unpacking django-countries==2.1.2 (from -r /vagrant/requirements.txt (line 20))
==> default:   Running setup.py (path:/home/vagrant/devenv/build/django-countries/setup.py) egg_info for package django-countries
==> default:     Traceback (most recent call last):
==> default:       File "<string>", line 17, in <module>
==> default:       File "/home/vagrant/devenv/build/django-countries/setup.py", line 23, in <module>
==> default:         long_description=long_description(),
==> default:       File "/home/vagrant/devenv/build/django-countries/setup.py", line 14, in long_description
==> default:         return readme.read()
==> default:       File "/home/vagrant/devenv/lib/python3.4/encodings/ascii.py", line 26, in decode
==> default:         return codecs.ascii_decode(input, self.errors)[0]
==> default:     UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1941: ordinal not in range(128)
==> default:     Complete output from command python setup.py egg_info:
==> default:     Traceback (most recent call last):
==> default: 
==> default:   File "<string>", line 17, in <module>
==> default: 
==> default:   File "/home/vagrant/devenv/build/django-countries/setup.py", line 23, in <module>
==> default: 
==> default:     long_description=long_description(),
==> default: 
==> default:   File "/home/vagrant/devenv/build/django-countries/setup.py", line 14, in long_description
==> default: 
==> default:     return readme.read()
==> default: 
==> default:   File "/home/vagrant/devenv/lib/python3.4/encodings/ascii.py", line 26, in decode
==> default: 
==> default:     return codecs.ascii_decode(input, self.errors)[0]
==> default: 
==> default: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1941: ordinal not in range(128)
==> default: 
==> default: ----------------------------------------
==> default: Cleaning up...
==> default: Command python setup.py egg_info failed with error code 1 in /home/vagrant/devenv/build/django-countries
==> default: Storing debug log for failure in /home/vagrant/.pip/pip.log
==> default: STDERR: 
==> default: ---- End output of /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt ----
==> default: Ran /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt returned 1

However, if I run it after doing vagrant ssh, and running the same command: /home/vagrant/devenv/bin/pip install -r /vagrant/requirements.txt, the output is correct:

Downloading/unpacking django-countries==2.1.2
  Downloading django-countries-2.1.2.tar.gz (187kB): 187kB downloaded
  Running setup.py (path:/home/vagrant/devenv/build/django-countries/setup.py) egg_info for package django-countries

Installing collected packages: django-countries
  Running setup.py install for django-countries

Successfully installed django-countries

Any idea of why this double behavior may be happening?

I've run into this same problem. Did you ever find a solution? I'm on the same Vagrant/Chef/Ubuntu versions and get the same UnicodeDecodeError.

Update: The django-countries package contains a Unicode character in its README.rst file (L74 in tag v2.1.2). The Å character is the one that throws the issue (position 1941) during pip install in the Chef / Vagrant environment. Manually running pip install in the Vagrant machine does not have any trouble installing the package.

Same problem- Ubuntu 14.04 Python 3.4 trying to install django-countires using pip install -r requirements.txt, I'm not using Vagrant.

Edit: I cannot install manually using pip install django-countries
Edit Again: I just realized this is not the issue tracker for django-countires. I will file a ticket there and link to this one :)

This was probably fixed by Chef's improved locale support in 12.