question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If "uname -rs" returns no output, _parse_uname_content causes exception

See original GitHub issue

Python version 3.5.2 OS: Ubuntu 16.04.6 LTS

I’m trying to install pip by using python3 get-pip.py --user. This is failing with “IndexError: list index out of range”. Running a debugger shows that the root cause seems to be that uname -rs returns no output on my system. The individual options work but not when combined.

Here is the exception stack trace:

Exception:
Traceback (most recent call last):
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_internal/commands/install.py", line 259, in run
    with self._build_session(options) as session:
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_internal/cli/base_command.py", line 79, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_internal/download.py", line 337, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_internal/download.py", line 100, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 120, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 675, in linux_distribution
    self.version(),
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 741, in version
    self.uname_attr('release')
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 910, in uname_attr
    return self._uname_info.get(attribute, '')
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 550, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 1037, in _uname_info
    return self._parse_uname_content(content)
  File "/tmp/tmpyrz_zul1/pip.zip/pip/_vendor/distro.py", line 1042, in _parse_uname_content
    match = re.search(r'^([^\s]+)\s+([\d\.]+)', lines[0].strip())
IndexError: list index out of range

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
HorlogeSkynetcommented, Jul 28, 2021

@brejoc I guess content and len(content) >= 1 would be a nit pick ; checking for content boolean evaluation should be sufficient.

0reactions
HorlogeSkynetcommented, Jul 30, 2021

Closing here as #304 is almost there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation fails because "uname -rs" produces no output #8356
Running a debugger reveals that the root cause seems to be that uname -rs returns no output on my system. The individual options...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found