$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up lsb-release (4.1+Debian11ubuntu6.1) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 290, in <module>
  File "/usr/bin/py3compile", line 270, in main
    options.force, options.optimize, e_patterns)
  File "/usr/bin/py3compile", line 156, in compile
    cfn = interpreter.cache_file(fn, version)
  File "/usr/share/python3/debpython/interpreter.py", line 212, in cache_file
    (fname[:-3], self.magic_tag(version), last_char))
  File "/usr/share/python3/debpython/interpreter.py", line 246, in magic_tag
    return self._execute('import imp; print(imp.get_tag())', version)
  File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
    raise Exception('{} failed with status code {}'.format(command, output['returncode']))
Exception: python3.4 -c 'import imp; print(imp.get_tag())' failed with status code 1
dpkg: error processing package lsb-release (--configure):
 subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • What if you run python3.4 -c 'import imp; print(imp.get_tag())' in a terminal window? – Gunnar Hjalmarsson May 17 '16 at 21:50
  • @GunnarHjalmarsson I get this: pastebin.com/raw/THSwEV7z – Ahi Tuna May 18 '16 at 14:50
  • Ok. When I run that command it simply returns cpython-34. So apparently you have a Python related problem, which causes the installation of the lsb-release package to fail. Probably it's not a problem with lsb-release in itself. – Gunnar Hjalmarsson May 18 '16 at 15:25
  • And _sysconfigdata_m comes with the libpython3.4-minimal package, so you may want to try: sudo apt install libpython3.4-minimal – Gunnar Hjalmarsson May 18 '16 at 15:31
  • $ sudo apt install libpython3.4-minimal Reading package lists... Done Building dependency tree Reading state information... Done libpython3.4-minimal is already the newest version. – Ahi Tuna May 18 '16 at 17:03

This is happening because you have a broken python install somewhere on your path, hopefully you still have a working one somewhere else but the broken one is being found first. If you google that error message you will see that it happens when you try to run python with libs from the wrong version. This usually happens if you install backports version and then upgrade or have installed an app that installs it own python.

try 'which python' and 'which python3' to see which ones are found.

if you find one that is not in /usr/bin/ then you could just make non executable and try again. If that works you need to find away to keep it off the path to fix this.

A good way to avoid this as a Python developer is to make pip install with --user so it doesn't touch the system python or to use a virtualenv.

  • You were correct that I had multiple python3 installations, one of which was in /usr/local/bin ... but even with that installation disabled, the problem still occurs when a which python3 call uses the correct 3.4 binary from /usr/bin ... pastebin.com/raw/dziZTVAk – Ahi Tuna May 24 '16 at 18:24
  • That looks fine , where does /etc/alternatives/python3 point to ? – Amias May 25 '16 at 6:57
  • My system has no /etc/alternatives/python3 link... so I created one and both cases don't resolve the issue: lrwxrwxrwx 1 root root 18 May 13 10:29 python -> /usr/bin/python2.7 lrwxrwxrwx 1 root root 16 May 25 10:58 python3 -> /usr/bin/python3 – Ahi Tuna May 25 '16 at 15:59

Upgrade to 16.04.1 and Python fixes itself :P

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.