I'm getting a weird error on my machine when I run...
# general
p
I'm getting a weird error on my machine when I run pants check specifically (with mypy):
Copy code
There was 1 error downloading required artifacts:
1. psycopg2 2.9.11 from <https://files.pythonhosted.org/packages/89/8d/9d12bc8677c24dad342ec777529bce705b3e785fa05d85122b5502b9ab55/psycopg2-2.9.11.tar.gz>
    pip:    ERROR: python setup.py egg_info exited with 1
Nobody else seems to be getting this error so I'm a bit confused
--pex-verbosity=9 and some command line surgery helped me find the actual error I think, would be kind of nice if this whole thing was surfaced:
Copy code
Error: pg_config executable not found.

  pg_config is required to build psycopg2 from source.  Please add the directory
  containing pg_config to the $PATH or specify the full executable path with the
  option:

      python setup.py build_ext --pg-config /path/to/pg_config build ...

  or with the pg_config option in 'setup.cfg'.

  If you prefer to avoid building psycopg2 from source, please install the PyPI
  'psycopg2-binary' package instead.
c
command line surgery
Could you elaborate on what else you had to add beyond
--pex-verbosity
?
p
I took the pip commands that were output at that verbosity and got them to run in the tmp sandbox, there was a flag/env var that didn't work (I think it was injecting a module of some sort), but thankfully it wasn't necessary to repro the error
I think the root cause of the annoying debugging experience is that pex condenses the error it gets from pip down to 1 line
b
@powerful-scooter-95162 FWIW Pex doesn't condense anything, it simply doesn't show Pip logs at all by default. If you / Pants want Pex to show Pip logs by default, the
--pex-verbosity
can be defaulted differently (IIRC level 3 or greater trigger Pip logs being shown). The problem you'll find is the Pip logs for a successful run are chatty - maybe ~1MB of logs. For an error you'll get a few KB more with the golden nugget info you want. To date, Pex makes no attempt to distill logs for error info and so does 0 parsing in that regard. It sounds like you want it to do this - try to parse Pip logs for relevant error output info. That would certainly be a new feature I could add if someone wanted to sponsor the work.
p
@brief-scientist-13682 I tried --pex-verbosity=9 and didn't see the error at all, I wonder if it was on stderr or something and swallowed. It should be easy to repro later, so I'll double check, but I didn't see the actual problem until I ran pip directly.
b
Alternatively it may be that you need to specify
--pip-log this-file.log
(to Pex directly), and then look at the log. That would be the basis for a simpler Pex feature. Basically always capture the full pip log and only dump it to stderr on error. You still get 1MB unhelpful + a few kb helpful dumped to stderr, but only on errors.