ImportError: No module named lsb_release

5,364

Ubuntu 14.04 has the lsb_release.py file installed for Python 2.7 as well and lsb_release seems to work under python2.7 as well. You can try this by doing:

python2.7 /usr/bin/lsb_release

If that works, make a backup of the file /usr/bin/lsb_release and change the first line to read:

#! /usr/bin/python2.7

(you can experiment with the -Es options, I would leave them out intially).

Once you can run apt-get again, reinstall python3 and it dependencies. You can determine the direct dependencies by using apt-cache depends python3 and use apt-rdepends or reverse-depends (both have to be installed) to get dependencies recursively.

Note - Find Original Answer by Anthon on unix.stckexchange.com

Share:
5,364

Related videos on Youtube

user3752051
Author by

user3752051

Updated on September 18, 2022

Comments

  • user3752051
    user3752051 almost 2 years

    When I run lsb_release -a , it shows an error:

    Traceback (most recent call last):
    File "/usr/bin/lsb_release", line 26, in <module>
    import lsb_release
    ImportError: No module named lsb_release
    

    I have change default python version Python2.7 to python2.6. Ubuntu 12.04

    how to solve this problem?

  • user3752051
    user3752051 about 8 years
    i need same solution for python2.6 i am using Ubuntu 12.04
  • TamaMcGlinn
    TamaMcGlinn about 4 years
    This difference occurs between python 3.5 and python 3.6. You can confirm that by doing just python3.5 -c 'import lsb_release' and similar for python3.6