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.

`pip` sometimes includes debug messages on `stdout`

See original GitHub issue

This is an abbreviated copy of #115 and #116, since those have been filled up with additional debugging.

Summary: In rare cases (currently N=1), we fail to collect environmental dependencies from PipSource. PipSource uses pip-api internally, which boils down to pip list --format=json.

What seems to happen is that the pip list --format=json command doesn’t emit just JSON. Instead, it also emits a trailing log message that looks like this:

Given no hashes to check 181 links for project 'pip': discarding no candidates

According to pip’s source code, that message is produced by a call to log.debug, which should be going to stderr instead of stdout. pip-api only uses stdout from pip subprocesses, so this is a strong indicator that the two streams are being mixed and/or confused somewhere, potentially with a logging override. The original reporter also traced the process and confirmed that the log was produced on stdout.

The original reporter found this on Python 3.9, pip version 20.3.3. I was unable to reproduce it locally, and they were also unable to reliably reproduce it locally.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
woodruffwcommented, Dec 7, 2021

Fixed with #196!

1reaction
dicommented, Dec 7, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

pip sometimes includes debug messages on stdout #122
According to pip 's source code, that message is produced by a call to log.debug , which should be going to stderr instead...
Read more >
log messages appearing twice with Python Logging
A call to logging.debug() calls logging.basicConfig() if there are no root handlers ...
Read more >
Multiprocessing Logging in Python
This logger is used within objects and functions within the multiprocessing module to log messages, such as debug messages that processes are ...
Read more >
Testing Python in Visual Studio Code
Testing Python in Visual Studio Code including the Test Explorer. ... You might occasionally need to step through and analyze tests in the...
Read more >
Output | Nmap Network Scanning
The default is called interactive output, and it is sent to standard output (stdout). There is also normal output, which is similar to...
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