Pip: return Command 'lsb_release -a' returned non-zero exit status 1.

Created on 15 Dec 2017  ·  15Comments  ·  Source: pypa/pip

  • Pip version: pip 9.0.1
  • Python version: python 3.6.3
  • Operating system: debian 9.3

Description:

when I'm installing pyssim using pip
pip is intalled and used under anaconda

What I've run:

pip install pyssim

Exception:
Traceback (most recent call last):
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/commands/install.py", line 272, in run
    with self._build_session(options) as session:
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/basecommand.py", line 72, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/download.py", line 329, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/download.py", line 93, in user_agent
    from pip._vendor import distro
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/_vendor/distro.py", line 1050, in <module>
    _distro = LinuxDistribution()
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/_vendor/distro.py", line 594, in __init__
    if include_lsb else {}
  File "/home/wujunde/anaconda3/lib/python3.6/site-packages/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
    raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.

crash auto-locked

Most helpful comment

sudo rm /usr/bin/lsb_release

It resolved my problem.

All 15 comments

Hi @WuJunde!

This has been fixed in the in-development version of pip. It's due to distro dropping support for python 2.6, much like pip will in it's next major release.

but my python is python3.6, is this error normal?

Ah. I misread. My bad.

If you run lsb_release -a at the command line, what is the output?

Thanks for @pfmoore, I fixed it.
The problem is all about lsb_release, nothing to do with pip
My python3.6 doesn't have lsb_release pack (don't know why)
I just change my ptyhon2.7 to run lsb_release
in /usr/bin/lsb_release
FROM:

! /usr/bin/python3 -Es

TO:

! /usr/bin/python2.7 -Es

Hello,
I also managed to get a similar error. I have Python2.7 and Python3 on my Ubuntu 16.04 but am unable to figure out why this error is popping when I try to use pip and ppa to add repositories. What could be the problem here and how could I resolve it. Here's the trace:

pip install -U pip
Exception: Traceback (most recent call last):
File "/home/ankit/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/ankit/.local/lib/python2.7/site-packages/pip/commands/install.py", line 272, in run
with self._build_session(options) as session:
File "/home/ankit/.local/lib/python2.7/site-packages/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/home/ankit/.local/lib/python2.7/site-packages/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/home/ankit/.local/lib/python2.7/site-packages/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 1050, in
_distro = LinuxDistribution()
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 933, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout)
CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
Traceback (most recent call last):
File "/home/ankit/miniconda2/bin/pip", line 11, in
sys.exit(main())
File "/home/ankit/.local/lib/python2.7/site-packages/pip/__init__.py", line 248, in main
return command.main(cmd_args)
File "/home/ankit/.local/lib/python2.7/site-packages/pip/basecommand.py", line 251, in main
timeout=min(5, options.timeout)) as session:
File "/home/ankit/.local/lib/python2.7/site-packages/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/home/ankit/.local/lib/python2.7/site-packages/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/home/ankit/.local/lib/python2.7/site-packages/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 1050, in
_distro = LinuxDistribution()
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/home/ankit/.local/lib/python2.7/site-packages/pip/_vendor/distro.py", line 933, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1

Thanks for your time.

I'm also unable to use pip all of a sudden on Ubuntu 16.04

When I run lsb_release -a I get:

File "/usr/bin/lsb_release", line 64
    print("No LSB modules are available.", file=sys.stderr)
                                               ^
SyntaxError: invalid syntax

The first entry of my _/usr/bin/lsb_release_ file:
#! /usr/bin/python2.7 -Es

There is a bunch of discussion about it on stack overflow

This is an Ubuntu issue. You can probably fix it by reinstalling lsb-core. Consider asking on Ubuntu support channels as to how to do that. :)

sudo rm /usr/bin/lsb_release

It resolved my problem.

sudo mv /usr/bin/lsb_release /usr/bin/lsb_release_back
just to be on the safe side

sudo rm /usr/bin/lsb_release

It resolved my problem.

it's right ,thanks ah.

sudo rm /usr/bin/lsb_release

It resolved my problem.

thans very much

sudo rm /usr/bin/lsb_release

It resolved my problem.

thanks

sudo rm /usr/bin/lsb_release

it also solves my problem, thanks

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings