-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip-compile's logs omit diagnostic messages from pip's subprocess error logging, when e.g. psycopg2 processing fails due to missing system (non-pip-managed) tools #1583
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
So trying I think this is just going to come down to installing some things pyscopg2 needs for its build environment to work properly, like |
The error message threw me. I used your recommendation and used the psycopg2-binary in requirements.in file and it worked. Thank you! |
Since psycopg2-binary isn't suitable for production, this issue can be solved by installing the postgresql development headers. On Debian based distros, it's called |
I would really like this reopened with the goal to provide a better error message. Anything that hints at the true root of the problem would be really helpful. |
Thanks! Let me see how the error presents and where pip-tools fits in: Setting up: $ podman run -it --rm docker://amazonlinux
# yum install -y python3
# python3 -m venv venv
# . ./venv/bin/activate
# pip install -U pip pip-tools Checking current pip-tools messages: # pip-compile - -o - <<<psycopg2 big outputERROR:pip.subprocessor:[present-diagnostic] python setup.py egg_info exited with 1
Traceback (most recent call last):
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 68, in generate_metadata
spinner=spinner,
File "/venv/lib64/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 224, in call_subprocess
raise error
pip._internal.exceptions.InstallationSubprocessError: python setup.py egg_info exited with 1
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/venv/bin/pip-compile", line 8, in <module>
sys.exit(cli())
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/venv/lib64/python3.7/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/venv/lib64/python3.7/site-packages/piptools/scripts/compile.py", line 466, in cli
results = resolver.resolve(max_rounds=max_rounds)
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 175, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 319, in _resolve_one_round
their_constraints.extend(self._iter_dependencies(best_match))
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 428, in _iter_dependencies
dependencies = self.repository.get_dependencies(ireq)
File "/venv/lib64/python3.7/site-packages/piptools/repositories/pypi.py", line 239, in get_dependencies
download_dir, ireq, wheel_cache
File "/venv/lib64/python3.7/site-packages/piptools/repositories/pypi.py", line 201, in resolve_reqs
results = resolver._resolve_one(reqset, ireq)
File "/venv/lib64/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 379, in _resolve_one
dist = self._get_dist_for(req_to_install)
File "/venv/lib64/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 332, in _get_dist_for
dist = self.preparer.prepare_linked_requirement(req)
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 487, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 560, in _prepare_linked_requirement
self.build_isolation,
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/venv/lib64/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 47, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/venv/lib64/python3.7/site-packages/pip/_internal/req/req_install.py", line 533, in prepare_metadata
details=details,
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 71, in generate_metadata
raise MetadataGenerationFailed(package_details=details) from error
pip._internal.exceptions.MetadataGenerationFailed: metadata generation failed The highlights from above:
Those are what led me to try with plain # pip-compile -vvv - -o - <<<psycopg2 big outputUsing indexes:
https://pypi.org/simple
ROUND 1
Current constraints:
psycopg2 (from -r -)
Finding the best candidates:
found candidate psycopg2==2.9.3 (constraint was <any>)
Finding secondary dependencies:
psycopg2==2.9.3 not in cache, need to check index
ERROR:pip.subprocessor:[present-diagnostic] python setup.py egg_info exited with 1
Traceback (most recent call last):
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 68, in generate_metadata
spinner=spinner,
File "/venv/lib64/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 224, in call_subprocess
raise error
pip._internal.exceptions.InstallationSubprocessError: python setup.py egg_info exited with 1
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/venv/bin/pip-compile", line 8, in <module>
sys.exit(cli())
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/venv/lib64/python3.7/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/venv/lib64/python3.7/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/venv/lib64/python3.7/site-packages/piptools/scripts/compile.py", line 466, in cli
results = resolver.resolve(max_rounds=max_rounds)
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 175, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 319, in _resolve_one_round
their_constraints.extend(self._iter_dependencies(best_match))
File "/venv/lib64/python3.7/site-packages/piptools/resolver.py", line 428, in _iter_dependencies
dependencies = self.repository.get_dependencies(ireq)
File "/venv/lib64/python3.7/site-packages/piptools/repositories/pypi.py", line 239, in get_dependencies
download_dir, ireq, wheel_cache
File "/venv/lib64/python3.7/site-packages/piptools/repositories/pypi.py", line 201, in resolve_reqs
results = resolver._resolve_one(reqset, ireq)
File "/venv/lib64/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 379, in _resolve_one
dist = self._get_dist_for(req_to_install)
File "/venv/lib64/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 332, in _get_dist_for
dist = self.preparer.prepare_linked_requirement(req)
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 487, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 560, in _prepare_linked_requirement
self.build_isolation,
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/venv/lib64/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 47, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/venv/lib64/python3.7/site-packages/pip/_internal/req/req_install.py", line 533, in prepare_metadata
details=details,
File "/venv/lib64/python3.7/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 71, in generate_metadata
raise MetadataGenerationFailed(package_details=details) from error
pip._internal.exceptions.MetadataGenerationFailed: metadata generation failed The improvement here is just making clear that the problem occurs when trying to do some installation operation with And what do we get with # pip install psycopg2 big outputCollecting psycopg2
Using cached psycopg2-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /tmp/pip-pip-egg-info-1p0ko9rt/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-1p0ko9rt/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-1p0ko9rt/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-1p0ko9rt/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-1p0ko9rt/psycopg2.egg-info/SOURCES.txt'
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.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details. Well that's much clearer, with a lot of explanation. OK. Maybe we can get more of that message into our own logs, at least with |
I think the content we want (mentioning It looks like it happens at
The exception is then passed (pip-internally) to OK, and I see When using |
I've found that we can get that output, at least with newer versions of pip, by using our old At this point I've got to tag out and ask for insight from anyone who's worked on the logging changes. Anything to add at this time? Pinging: @nicoa @davisagli @hugovk @di |
I can take another look at this tomorrow. Complete guess, but maybe some difference between handling pip’s stdout and stderr?
David
… On Mar 17, 2022, at 5:41 PM, Dustin Ingram ***@***.***> wrote:
See the comment here about why it was recommended to skip _setup_logging for newer pip versions. IIRC this seemed to be correct based on my testing for #1567.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
It looks like pip-tools probably needs the following changes:
|
Btw as an easier way to reproduce this I created |
When I use psycopg2 in my requirements.in file then pip-compile fails and throw an exception and does not generate a requirements.txt file. I am using venv but that should not cause a problem.
Environment Versions
The currently installed packages in this venv are:
Steps to replicate
Expected result
An output file in requirements.txt
Actual result
It fails with:
The text was updated successfully, but these errors were encountered: