2

Everything that depends on the lsb_release command is not working on my computer.

example:

pip install numpy

raise subprocess.CalledProcessError(code, cmd, stdout, stderr) subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1

And in fact, lsb_release -a generates an error

File "/usr/bin/lsb_release", line 95, in <module>
    main()
  File "/usr/bin/lsb_release", line 59, in main
    distinfo = lsb_release.get_distro_information()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 383, in get_distro_information
    distinfo = guess_debian_release()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 281, in guess_debian_release
    get_distro_info(distinfo['ID'])
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in get_distro_info
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 41, in <lambda>
    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
ValueError: could not convert string to float: '8.04 LTS'

I know that in python '8.04 LTS' cannot be converted to a float, but why is this happening.

I've tried to reinstall both lsb_release and python-pip but this does not fix the problem.

I'm on Ubuntu 16.04 LTS. any help ?

Ghilas BELHADJ
  • 162
  • 1
  • 9
  • Maybe something relevant here? [original lsb-release file should be preserved for classic mode](https://bugs.launchpad.net/snappy/+bug/1650207) – steeldriver Jul 01 '17 at 13:27

1 Answers1

3

I had the same error on one of my VMs, the other 2 and hypervisor were fine. Same release (16.04.3), not a clue what caused it. It's a known bug.

I got some relief here

Modify the file /usr/share/pyshared/lsb_release.py line 41 from:

RELEASES_ORDER.sort(key=lambda n: float(n[0])) 

to:

RELEASES_ORDER.sort(key=lambda n: float(n[0].split()[0]))

Fixed the problem for me. Complete credit to SHIINA Hideaki (shiina) at Ubuntu bug launchpad. I'm just reposting it here.

muru
  • 193,181
  • 53
  • 473
  • 722