close

[Solved] pip is showing error ‘lsb_release -a’ returned non-zero exit status 1

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error pip is showing error ‘lsb_release -a’ returned non-zero exit status 1 in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How pip is showing error ‘lsb_release -a’ returned non-zero exit status 1 Error Occurs?

Today I get the following error pip is showing error ‘lsb_release -a’ returned non-zero exit status 1 in python.

How To Solve pip is showing error ‘lsb_release -a’ returned non-zero exit status 1 Error ?

  1. How To Solve pip is showing error 'lsb_release -a' returned non-zero exit status 1 Error ?

    To Solve pip is showing error 'lsb_release -a' returned non-zero exit status 1 Error UPDATE May 2019: Newer versions of Linux are shipping with Python3 by default. As noted in the comments here, you may just need to use a specific version of Python 3.

  2. pip is showing error 'lsb_release -a' returned non-zero exit status 1

    To Solve pip is showing error 'lsb_release -a' returned non-zero exit status 1 Error UPDATE May 2019: Newer versions of Linux are shipping with Python3 by default. As noted in the comments here, you may just need to use a specific version of Python 3.

Solution 1

Ahhh the classic lsb_release issue. I have battled this problem many times. The issue is that your default Python implementation is trying to use Python 3 but lsb_release requires Python 2. To fix this problem do the following:

  • Open /usr/bin/lsb_release (Make sure you use sudo or open as root!)
  • Edit the first line to be #! /usr/bin/python2.7
  • Save the file

now you can use pip again and everything should be fine.

UPDATE May 2019: Newer versions of Linux are shipping with Python3 by default. As noted in the comments here, you may just need to use a specific version of Python 3.

Solution 2


In short, it was solved doing this:

$ sudo ln -s /usr/share/pyshared/lsb_release.py /usr/local/lib/python3.8/site-packages/lsb_release.py

Details:

When trying $ sudo pip3 install something I had the error referred in this thread:

... a long traceback, and ... 
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

It started to happen after updating from python 3.5 to 3.8. I have tried several solutions without success. A clue for the solution came when executing $ lsb_release -a which gave me the following error:

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

This other error message led me to this solution which is explaining that from version 3.6 python has no lsb_release.py file any more. The solution is just creating a link for this missing file.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read