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 silently fails to install extras and returns error code

See original GitHub issue

It seems that pip just returns success code on anything related to use of extras, commands like: pip install -e .[non_exiting_extra] reports success.

Even worse, with existing extras that may fail to install, the final result code is still a success, when in fact pip failed to install dependencies.

This is a critical bug because it directly affect CI usage where we can no longer trust result code from pip, bugs may go in unnoticed.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:23 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
hudsonftcommented, Jan 13, 2022

I don’t know a lot about the tradeoffs but I’ll add one more vote for changing this from a warning to an error. I probably should understand this better, but apparently if any transitive dependency is installed with an invalid extra you won’t be able to load entrypoints from an upstream package. e.g. Lets say package A depends on package B, and B requires C[invalid_extra], package A also has entrypoint "my_group": "my_extra=A.foo.Bar" Running

from pkg_resources import iter_entry_points
print([e.load() for e in iter_entry_points('my_group', 'my_extra')])

will give

pkg_resources.UnknownExtra: C X.X.X has no such extra feature 'invalid_extra'

This is a bug in package B, but it would be easy for it to slip through their CI unless someone happened to know this behavior (which is unexpected to me). Having pip error out on missing extras would make this easier to catch.

2reactions
chrahuntcommented, Oct 1, 2019

Not fully ignore - I believe we trace a warning.

Returning non-zero would be backwards incompatible. I would be +1 on doing it (even aborting installation if we are not able to find an extra), but it would need to be changed over at least 1-2 releases. The first step would be to add to the existing warning to say that it’s unsupported and will fail in a future release. We’d also want to go through pypi and see how many packages make reference to nonexistent extras.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify extras_require with pip install -e - Stack Overflow
I know that you can do pip install project[extra] when the project is on pypi. And you have to do pip install -e...
Read more >
pip install - pip documentation v22.3.1
A failed install is less likely to leave a broken environment. ... pip looks for packages in a number of places: on PyPI...
Read more >
Changelog — Python 3.11.1 documentation
The errno modules exposes the new error number. getpath.py now ignores PermissionError when it ... gh-98940: Fix Mac/Extras.install.py file filter bug.
Read more >
pipenv Documentation - Read the Docs
The recommended way to install pipenv on most platforms is to install from pypi ... The command will perform a verification, and return...
Read more >
Commands | Documentation | Poetry - Python dependency ...
--all-extras : Install all extra features (conflicts with –extras). --no-dev : Do not install dev dependencies. (Deprecated, use --without dev or --only main ......
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