Trying to install the latest PHP5 packages and so I add the repo ( sudo add-apt-repository ppa:ondrej/php5) I need and this is the outcome:

    Traceback (most recent call last):
  File "/usr/lib/python3.2/threading.py", line 740, in _bootstrap_inner
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 141, in run
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in add_ppa_signing_key
    tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 186, in _verify_fingerprint
    got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 178, in _get_fingerprints
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.2/subprocess.py", line 516, in check_output
    output, unused_err = process.communicate()
  File "/usr/lib/python3.2/subprocess.py", line 811, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python3.2/subprocess.py", line 456, in _eintr_retry_call
    return func(*args)
  File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 92: ordinal not in range(128)

Running on Ubuntu 12.04 Server

  • 1
    Have you messed with the default python installation (for example, symlinking python3.2 to /usr/bin/python?) - apt should be using the system default python2.7 on 12.04. Can you add the output of ls -l $(which python) to your post? Commented Jul 1, 2014 at 19:25
  • lrwxrwxrwx 1 root root 9 Apr 10 2013 /usr/bin/python -> python2.7 I did install the packages in order to get apt-add-repo (which messes with Python iiirc) Commented Jul 2, 2014 at 10:32
  • In that case I don't understand why it's apparently using python3.2 - sorry Commented Jul 2, 2014 at 12:05

4 Answers 4


The software-properties-common is buggy, so if have a time, please report this as a bug in software-properties-common.

A better workaround was pointed out in the issue tracker that uses specific unicode locale when adding the repository

LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-5.6

Try installing a language pack which may correct your issues with encoding, e.g.

sudo apt-get install language-pack-en

This will provide English translation data updates for all supported packages (including Python).

See: UnicodeEncodeError: 'ascii' codec can't encode character.

Otherwise set the locale settings manually, e.g.

$ locale -a | grep "^en_.\+UTF-8"
$ export LC_ALL=en_GB.UTF-8
$ export LANG=en_GB.UTF-8

Related: locale error with apt-get install


If you are in docker, this worked for me:

RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php

An after:

RUN apt-get update
RUN apt-get install -y php7.2

For me adding php5-compat before php solved my problem on ubuntu 16.

sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat

and then

sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php

You must log in to answer this question.

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