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
22.1: Editable installs for packages with extras & flit causes UndefinedEnvironmentName
#11110
Comments
pyproject.toml
fails with 22.1UndefinedEnvironmentName
OK, I can reproduce this by cloning sigstore and running This seems to have broken editable installs for any package that has extras and uses setuptools. Also, TIL that setuptools throws all your runtime dependencies as build-time dependencies as well (at least for editable installs). That's... a very interesting choice. I think the fix for this would be to not have any optional-dependencies installed in the build environment, by passing |
Not sure if this is helpful, but I am just checking Airflow and we have no problems with new 1} Checkout https://github.com/apache/airflow One of the things the venv intialization does is:
And it works flawlessly. |
I also checked this scenario on one of my projects and could not reproduce. Side note: since |
UndefinedEnvironmentName
UndefinedEnvironmentName
Ah, indeed. I misunderstood that it was using setuptools' experimental support for pyproject.toml, and wasn't looking carefully. :) This is indeed a flit-specific issue. When it can't figure out what the version of the package is (either by looking at This is happening because sigstore has an additional indirection for loading the version, for some reason, so a simple AST parse is not able to find the version. So... the use case is significantly less disruptive -- for packages that use flit, define extras and don't want to maintain a static version in pyproject.toml or the |
This possibly could be fixed in sigstore then? It does not seem like worth fixing in |
There are a number of options here:
It's worth noting that I agree with @pradyunsg's comment
I think it's worth us adding the workaround, so that our behaviour is explicit, and doesn't trigger an error. But flit needs to decide whether they want to support this usage, given we don't install extras, and possibly fix their approach. And honestly, IMO sigstore should probably just not try to be so clever 🙂 (or to put it another way, I'd be 100% fine with flit choosing to simply error in this case). |
I’m running into this without editable mode and without specifying extras. There pure existence seems to be enough? I have a flit project with: [project.optional-dependencies]
dev = ['boto3-stubs[ecs,s3,sqs,ssm]', ...] and running
PS: Way to deflect blame, pip, you’re your own subprocess!
|
I'm wondering - are we checking the build requirements are installed in every build environment, or just when Regardless, though, checking just non-optional dependencies should avoid the problem. We're not going to install build dependencies that are specified as optional, so a backend (or project) that needs them is probably just broken. But we should ignore them quietly, rather than just fail - being strict here doesn't serve any useful purpose. |
I would appreciate a quick fix before I have to update all our CI pipelines with |
We currently do check requirements in all build environments. It’s probably a carry-over from the old resolver time, when the build environment can be populated incorrectly. |
I agree completely. I wasn't aware we were triggering such clever behavior! I'm going to make the necessary fixes on |
Flit supported it so far, so changing it will break a lot of packages, including basically all of mine (private, public, and commercial). Flit should definitely not suddenly stop supporting this. In the future I’ll use hatch-vcs to make things like this more convenient, but until recently, flit (relying on this behavior) was the best option for me. |
We also ran into this today. We dynamically generate the version via flit-scm so flit getting the version by importing the package is a requirement for us. |
At a minimum, flit could not include optional dependencies when generating the list of build dependencies, as they'll be ignored anyway. But this should be discussed on the flit tracker, not here. |
I ran into this issue with a normal install from source (i.e. not an editable install). Regardless, #11112 fixed it for me. |
Yeah this is not specific to editable installs, but any PEP 517 scenarios as well. This only happens to editables now because we recently added support to PEP 660, which shares the build environment population logic to PEP 517. |
Description
First of all, thanks for
pip
and for taking the time to read this issue!We use editable installs on sigstore-python to provide a convenient development environment. For example, either with or without the
dev
extra:Our dependencies are entirely managed within a
pyproject.toml
, with a small stubsetup.py
to helppip
do an editable install.Up until
pip==22.1
, these commands worked just fine. Upon upgrading to22.1
(released today), we get this error:(I've truncated the traceback. I'll paste the full-length trace below.)
When I run with
--debug
, I see that thedev
extra is being passed in as an environment marker, which then fails sinceextra
is not included in the marker environment.Expected behavior
I expect
pip install --editable .
to behave the same as it did in the last stable release (22.0.4), i.e. install correctly with no errors.pip version
22.1
Python version
3.10.0
OS
macOS 12.3.1
How to Reproduce
These steps should reproduce the failure:
If that fails to pull down the latest
pip
for whatever reason, you can do it explicitly:Output
Code of Conduct
The text was updated successfully, but these errors were encountered: