-
IssueHi! I do deep learning and am currently trying to switch to poetry for better dependencies management 😄
In order to solve the first problem (even if an official support from Poetry would be appreciated), I went with the famous light-the-torch, that automatically installs the right PyTorch version depending on the detected backend. Also, specifying the PyTorch url in the This means that Poetry is not currently compatible with PyTorch. I don't think that saying that PyTorch is a special case is a good idea since this release design just exposes the need to compile a package for each particular software stack, so it is really a general problem which must be solved IMO. I'll be happy to discuss below of how Poetry must adapt to this design! |
Beta Was this translation helpful? Give feedback.
Replies: 21 comments 4 replies
-
A solution would be to have a post-install hook that runs |
Beta Was this translation helpful? Give feedback.
-
Duplicate #2145 -- this is in general pretty out of scope for Poetry as things currently exist, but possible with a plugin. Painful, but possible, and we can gradually introduce hooks to make this sort of thing easier. Keep in mind that this is, in fact, highly specific to PyTorch -- there is no standard convention for distributing wheels built against different ML APIs. PyTorch does it one way, and other ML packages do it in other ways. A standard for describing and reasoning about wheel compatibility is needed for support in Poetry beyond a package-specific plugin, as the In order for broad support in the ecosystem (including natively in Poetry) to happen, standardization of ML APIs/ABIs is necessary as part of the wheel spec (or a successor). |
Beta Was this translation helpful? Give feedback.
-
I totally agree that there is no standard for this, but the problem is still present so some help could be given on Poetry's side through tools such as hooks and package freezing I hope |
Beta Was this translation helpful? Give feedback.
-
If you're willing to freeze versions there's no problem -- add the correct Per #6409 performance leaves something to be desired as currently we emulate pip (+ the new resolver)'s behavior of checking every index exhaustively. However, you can do what you want today. If you are talking about install-time selection of the proper variant, that is a full duplicate of the issue I linked. The best we'll be able to do until such time that we standardize markers in the ecosystem is adding some sort of hooks for custom markers -- but there's a lot of work necessary on the Plugin API before we can even think about such hooks. |
Beta Was this translation helpful? Give feedback.
-
Downloading 50 GB of package is not an option for me sadly, so this leaves me with no solution I guess |
Beta Was this translation helpful? Give feedback.
-
It's very unclear what you want, I think. Are you asking for some way to add packages to a Poetry environment using #4956 or a successor will help you if you want to limit the scope of compatibility (e.g. you never plan to install on Windows so you don't care about solving for Windows). Basically, if you don't want to solve ahead of time and have a universal If you're willing to accept solving ahead of time requiring downloading PyTorch wheels, |
Beta Was this translation helpful? Give feedback.
-
@BlueskyFR I would try addressing this issue with PyTorch team, since it's them doing non-standard things. I don't like the idea of Poetry, which is based on widely accepted standards, having to adapt to non-standard ways. The way I see it, they could have a simple wheel on PyPI that would provide CLI for setting up a proper environment. |
Beta Was this translation helpful? Give feedback.
-
@neersighted sorry for being unclear. What I want is the following:
Is it possible? |
Beta Was this translation helpful? Give feedback.
-
In the same spirit, what if I want to install a custom built PyTorch version? |
Beta Was this translation helpful? Give feedback.
-
You're really asking for a feature where you can inject 'fake' packages into Poetry's resolution, so that Poetry considers them satisfied and solved for. I'd create a new feature request issue for that -- the basic idea is that you would specify something like: [tool.poetry]
dependencies-external = ["pytorch"] And Poetry would consider Please note the above design is ad-hoc -- what the final design would look like, and if this would be accepted by the project at all would have to be hammered out on the FR issue you create, and/or on the PR defining the implementation. |
Beta Was this translation helpful? Give feedback.
-
You can do this today with URL dependencies and markers (but, as markers do not include any facility to discriminate based on ML API, this doesn't solve anything you couldn't do already with the pytorch indexes). |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. |
Beta Was this translation helpful? Give feedback.
-
Poetry is not designed to interoperate with other tools that manipulate packages in its dependency tree, no. Even if we add the feature I described above, it will always be a best-effort/"it happens to work" sort of thing. That is to say, you're taking a lot into your own hands, and if Poetry's incomplete solution ignoring a package breaks when combined with LTT's, that's on you to solve, since it's not reasonably a problem with either Poetry or LTT. |
Beta Was this translation helpful? Give feedback.
-
That's right, but I am just disappointed by the fact that no way to manage dependencies in a PyTorch project 😢 |
Beta Was this translation helpful? Give feedback.
-
Sorry to hear that -- Poetry works fine for users who are able to ensure a consistent ML API situation across all their install targets. For Poetry to 'just work' across APIs and not require compromises like the proposed feature above, this is a topic for the PyPA, discuss.python.org, and a PEP defining ML APIs as a new wheel tag. |
Beta Was this translation helpful? Give feedback.
-
Is the issue with the secondary download url being adressed? That would be the beginning of a solution |
Beta Was this translation helpful? Give feedback.
-
That's purely cosmetic -- it's a consequence of how additional sources are designed, and if you run pip in verbose mode with #5984 (comment) is a proposal to solve this by breaking the 'purely pip-like' semantics of non-PyPI sources. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
If the wheel wasn't installed by Poetry, it may be missing a PEP 610 marker, aka Poetry is not downloading a second time in your screenshot -- it is merely installing a wheel it should have already downloaded. That being said, it's possible you've hit #2415 which isn't clearly logged. This is getting fairly off topic and turning into more of a support discussion (and I think the original issue was more of question than anything actionable anyway) -- I'm migrating this to Discussions as such. |
Beta Was this translation helpful? Give feedback.
-
I deleted the env and then installed everything: the wheels were only downloaded once. |
Beta Was this translation helpful? Give feedback.
-
Conclusion: Poetry does not support machine learning version markers as it not a standard; Thanks for the help! |
Beta Was this translation helpful? Give feedback.
Conclusion: Poetry does not support machine learning version markers as it not a standard;
Also, when specifying a download url for a wheel dependency, it is downloaded multiple times (#2415), with a fix proposed in #6614
Thanks for the help!