-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pkg_resources hard-fails on install_requires for entry point. #1471
Comments
Have you tried using the entrypoints project? I suspect because it bypasses pkg_resources, it also bypasses the working set consistency check that leads to the DistributionNotFound error. I should note that there are other errors besides DistributionNotFound that can result from attempting to load entrypoints (or even just importing pkg_resources), such as a |
@jaraco Can we just turn those all into warnings for the purposes of We can maybe have an option to re-enable the old behavior, but I think by default this sort of thing should be enforced only at build time, not at runtime. If you want a hard version check at runtime, that should be opt-in, and we should let entry points with missing dependencies fail only if the missing dependency itself causes a failure. |
Hi,
the docs say in optional-dependencies section
But if that does not happen, either the docs are wrong, or there is a bug. Are there plans to fix it, or did I miss anything? |
I mean, this seems to be still unresolved but there is no "bug" label on it... |
…cies to indicate that the handling is mostly implementation specific. Ref #1471.
The docs may well be wrong. There was a recent revamp where a passionate user attempted to describe what behavior they expected, but it may not map to the actual implementation. I suspect the actual implementation is that the indicated console script will only be installed if the relevant extras are requested. Here's what the old docs said, and that sounds closer to the implementation. Hmm. Looking at the docs, that's also consistent with what's written here. In c657e82, I've corrected the documentation to declare that the behavior is implementation-specific. In another comment, I'll address the larger issue. |
I see that this issue has been fixed in #2194 by bypassing pkg_resources in the easy_install scripts and instead relying on importlib.metadata:
All you need to do is make sure you have Setuptools 47.2 or later and Python 3.8 or |
…on 51.1.1 Chih-Hsuan Yen (2): Fix test_test_command_install_requirements with pip 20.3+ Fix tests with pytest 6.2 Henry Schreiner (1): docs: recommend pypa build Jason R. Coombs (35): Add Tidelift template Rely on alabaster theme to support sidebar rendering. Use nicer, simpler phrasing Add support for automatic publishing of release notes Use technique for environment passing matching that found in jaraco/skeleton Move Tidelift token into Travis configuration Update badge URL Add funding reference to project List sidebars to avoid errors looking for template 't' Rebrand to 'For Enterprise' Add a 'For Enterprise' section to the README Include token passthrough for azure pipelines publish stage. Move Tidelift release note publishing to Github Actions. Collapse skeleton history from archive/2020-12 Include rst files in docs in sdist. Fixes #2477. Update changelog. Ref #2484. Move changelog to new issue. Fixes #2485. Update changelog. Restore fail on warning in docs builds. Remove redundant dependencies Add PyPy3 to list of Pythons tested Ensure windir is passed in environment. Bump version: 51.0.0 → 51.1.0 Disable integration tests on PyPy on Windows. Ref #2496. Fix syntax in test_build_meta, version should not have quotes. Bug was masked by LegacyVersion parsing. Fix badge for GHA Unset tag_build and tag_date prior to cutting a release. Fixes #2500. Include tmpl files in manifest template. Workaround for #2498. Replace incorrect statement about triggering installation of dependencies to indicate that the handling is mostly implementation specific. Ref pypa/setuptools#1471. Update changelog. Ref #1471. In test_test_command_install_requirements, uninstall setuptools to avoid getting some other version in the environment. Disable index URL in pip-based fetch_build_eggs to avoid hitting PyPI. Update changelog. Rename changelog Bump version: 51.1.0 → 51.1.1 Matt Deitke (1): typo
This has bitten us a few times now, I think that
pkg_resources
is a bit aggressive aboutinstall_requires
, so when you attempt to invoke an entry point, theinstall_requires
list is checked, and if any of the dependencies are missing, the script fails to start.This problem has come up because we have a system that side-loads pre-built source (a la DPKG and presumably other package managers) where the dependencies are declared by the package manager (so
install_requires
is actually mostly ignored at install time). Occasionally we have needed to change the name of the package deployed by the package manager even though the importable path has not changed. If someone has the old package name in theirinstall_requires
and invokes their script viapython -m mypkg
, it works fine, but if they are invoking through an entry point, the script fails to run because the dependencies are not installed.To demonstrate, I have prepared a small repository that demonstrates this behavior.
This is a real problem because it occurs at runtime and there doesn't seem to be any obvious way to "shim" around it other than by providing a dummy package (with no easy way to notify users that they are relying on this dummy package).
I suggest changing the
DistributionNotFound
error into a warning instead.The text was updated successfully, but these errors were encountered: