-
Notifications
You must be signed in to change notification settings - Fork 3k
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
"conflict with the backend dependencies" error running pip install in editable mode with pyproject.toml / PEP-517 enabled project #6314
Comments
Note that it looks like attrs just released 19.1, which could explain why it just started happening: |
Does poetry auto-generate a setup.py? Because the logs show pip being used to install carly in editable mode, but pip doesn't support editable mode without a setup.py: #6206 , and carly doesn't seem like it has a setup.py. |
Good spot on the attrs release. What's interesting here is that while carly specifies "attrs 18.x", poetry doesn't depend on attrs at all. (although, of course, one of its dependencies might?) Answers in order:
|
If you look at poetry's source code, here is where it auto-generates a setup.py prior to calling pip install in editable mode: https://github.com/sdispater/poetry/blob/0222bf6bcbe0a55bfe2c5d593beb667a47b8a752/poetry/console/commands/install.py#L85-L89 if has_setup:
self.line("<warning>A setup.py file already exists. Using it.</warning>")
else:
with setup.open("w", encoding="utf-8") as f:
f.write(decode(builder.build_setup()))
try:
self.env.run("pip", "install", "-e", str(setup.parent), "--no-deps") |
Some pdb'ing later, yes, it looks like poetry does generate a setup.py (and then delete it):
|
@cjerdonek - hah! crossing the streams... okay, so what is requiring attrs >=19? |
I don't know.. I would suggest trying to reproduce the issue (if there is one) independent of poetry and Travis CI, as there are currently a lot of confounding factors. Hopefully this provides more of a start. You might also want to try examining what's installed in the environment at the time poetry invokes |
Right, here's the answer courtesy of @wimglenn's excellent johnnydep for poetry:
So, jsonschema depends on attrs >17.4, but it looks like the time Here's a hypothesis: pip is picking the build system out of pyproject.toml during the To your comments about "confounding factors", I'm afraid I'm not sure I agree. Travis is great as we know it's using a sterile, up-to-date and reproducible environment (Circle CI does the same). The fact that poetry is involved is somewhat the crux of the matter here... |
Pinging @sdispater in case he has inputs here. |
My point was just that if an issue can't be reproduced independent of Travis and poetry, then it's not clear the issue lies with pip. If it's an issue with poetry, then it should be resolved on poetry's tracker rather than here.. |
I don't believe pip looks at pyproject.toml when run in editable mode (that's what I was saying above). |
Here's a minimal reproducer: https://github.com/cjw296/pip6314 It looks like pip is confusing install-time requirements of carly with build-time requirements. It's unclear why, but the I'm speculating, but this feels like a combination of poetry being unusual in generating a dynamic setup.py, and potentially bug(s) in both pip's PEP-517 implementation and poetry's (ab)use of pip. |
Thanks for the simple reproducer! Some preliminary thoughts are below. Note that this is just me thinking out loud and shouldn't be interpreted as anything ironclad. Without having investigated fully, my initial instinct is that maybe pip should be erroring out if it's in the position of being instructed to use PEP 517 when Another reason is that PEP 517 doesn't support editable installs yet (link):
In addition, an advantage to erroring out now is that it preserves In terms of what's happening now, to avoid this issue it seems like it would address the issue and could only help if poetry either--
|
While it's probably "correct" that pip should error out when it finds both PEP 517 when doing a -e, in this case it would turn a bug that can be worked around into a total show stopper :-/ |
If |
Hmm, I'm a little surprised pip/src/pip/_internal/pyproject.py Lines 84 to 93 in 4589ed4
Maybe that logic can still be adjusted (e.g. at least in the case of editable mode which isn't currently supported by PEP 517 anyways). Regarding poetry moving |
If PEP 517 is being used,
That is correct. If you try to insist on not using PEP 517 in a project that has a I'd take a hardline view here. Given that PEP 517 doesn't support editable installs, projects shouldn't be using PEP 517 if they want to support them. If this is a problem, then the solution should be for someone to do the work of defining a PEP 517 compatible standard for editable installs. Then pip (and any other frontends that are developed) can support it cleanly for any backend that provides editable install support.
+1 on this. I think that the standards should support poetry, and I'd be more than happy if the poetry project engaged with the standards process to make sure that happens. But as things stand right now, poetry seems to be doing its own thing and so adding some additional customisation to cover this situation seems entirely reasonable to me. |
Okay, thanks a lot for weighing in here, @pfmoore. Then the way forward on this issue in the short-term (separate from the longer term effort to expand PEP 517 to cover editable installs) is a PR for pip to "fail fast" with a clear message if someone is trying to install in editable mode a project that requires PEP 517 to be used. |
Yes, that sounds reasonable. |
Hmm, while I don't disagree on the reasoning, that "bugfix" will kill poetry or force poetry users to say on pip 18, at a time when @sdispater doesn't appear to be available to work on poetry. @pfmoore - as far as "poetry seems to be doing its own thing" goes, I think you pointed out why that is: there's no standard for editable installs, so I feel your wording is a little harsh. I wonder how flit does editable installs? @takluyver? (or does flit only deal with building wheels, rather than managing a development environment?) |
Sorry if I sounded harsh, maybe I wasn't clear. All I meant was that as poetry is already modifying files here, moving Flit doesn't support editable installs. That's precisely the reason editable installs were dropped from PEP 517 - there's no clear view on how any backend other than setuptools can handle them, so short of blessing setuptools' behaviour (and risking getting into a situation where no other backend can offer editable support, because the spec is too tided to details of how setuptools does things) it was better to defer support. Well, that plus the fact that everyone was so burned out getting as far as we did, that no-one wanted to open up yet another can of worms at that point. |
Remember @cjw296 that there's a fairly targeted (perhaps even simple and straightforward) change that poetry can make to resolve things, as we discussed above. So I wouldn't say it would "kill" poetry. |
Flit does, but not through the PEP 517 APIs, so you can't use pip to get an editable install of a Flit-packaged project. You can run My rationale is partly that the point of an editable install is to test a package you are actively working on, so it makes sense to set it up through a package authoring tool (flit) rather than a package consumption tool (pip). Plus, as you say, we were all exhausted by what we did try to standardise. |
Thanks for the clarification. Your rationale makes sense, although there's a strong push from certain quarters for everything to be accessible via pip (or more precisely "the build frontend"). So I suspect the issue of having editable install support as an extension to PEP 517 could re-emerge at some point. |
Yup, I'm not against trying to specify some hook for editable installs. But I'm happy enough to let it rest for now. |
I started work on a PR for this here: #6331. (There is still a failing test I need to sort out after making the change.) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Environment
Description
Around a day ago, my cron-triggered builds on Travis for one projects started failing with
Some build dependencies for file:///home/travis/build/cjw296/carly conflict with the backend dependencies: attrs==19.1.0 is incompatible with attrs<19.0 ,>=18.2.
when being installed by poetry. Looks like under the hood, poetry is calling['/home/travis/virtualenv/python2.7.15/bin/pip', 'install', '-e', '/ home/travis/build/cjw296/carly', '--no-deps']
which would suggest that dependencies should be ignored.The full build log for this first failure is here: https://travis-ci.org/cjw296/carly/jobs/501041034
There is a poetry issue open for this here: python-poetry/poetry#826
It's unclear whether this is a poetry bug or a pip bug, but it appears that either downgrading to pip 18.x or removing the
build-system
section frompyproject.toml
stop this happening.What's super confusing is that my particular builds are run nightly and they only started failing on 3rd March, even though neither pip nor poetry had any releases around that date, and I haven't made any code changes to carly since 20th Feb.
Expected behavior
This build log shows expected behaviour:
https://travis-ci.org/cjw296/carly/jobs/500733549
How to Reproduce
These are the steps:
https://github.com/cjw296/carly/blob/6ec7eedea9c8405ea6a61f733cb7ee9dfaa9b801/.travis.yml#L21-L23
These should be run against https://github.com/cjw296/carly/tree/6ec7eedea9c8405ea6a61f733cb7ee9dfaa9b801
Output
The text was updated successfully, but these errors were encountered: