Repository navigation
build: move vesin[torch] to the torch extra (fix conda-forge) - #5501
Conversation
vesin's torch bindings ship as a separate PyPI package (vesin-torch, pulled in by the vesin[torch] extra). conda-forge packages vesin but not vesin-torch, so listing vesin[torch] in the core dependencies breaks the conda-forge build. Move it under the torch optional-dependency extra (get_pt_requirement), so only deepmd-kit[torch] (pip) pulls it; the runtime already guards usage via is_vesin_torch_available().
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR relocates the ChangesConditional vesin[torch] dependency handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5501 +/- ##
==========================================
- Coverage 81.42% 81.41% -0.01%
==========================================
Files 871 871
Lines 96951 96952 +1
Branches 4240 4241 +1
==========================================
- Hits 78941 78938 -3
- Misses 16707 16711 +4
Partials 1303 1303 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…mportable (deepmodeling#6037) > **This PR has been reduced, and the original description was wrong.** It claimed that nothing in > the project metadata declares a neighbor-list backend, and added a `dpa4` extra to fix that. The > claim was false: `deepmd` assembles extras through a custom build backend, and > `backend/find_pytorch.py` already declares `e3nn>=0.5.9`, `vesin[torch]` and > `nvalchemi-toolkit-ops>=0.3.1` under the `torch` extra — visible in the built metadata as > `vesin[torch]; extra == "torch"`, and put there deliberately by deepmodeling#5501. I had checked only > `pyproject.toml`, where none of those strings appear. The `dpa4` extra duplicated an extra that > already exists and has been removed, together with the test that parsed `pyproject.toml`. > > What is left is the half that never depended on that claim: the error message. The DPA-4 / SeZM descriptor needs `vesin` or `nvalchemiops` at runtime, and both ship with the `torch` extra. An environment that has the rest of the PyTorch stack but no neighbor-list backend builds a model and then stops at: ``` RuntimeError: SeZM neighbor-list construction requires either 'nvalchemiops' or 'vesin', but neither is importable. ``` `nvalchemiops` and `vesin` are *import* names. Neither is what a user types into pip: the first comes from the distribution `nvalchemi-toolkit-ops`, and the second needs its `torch` extra, because the torch bindings ship separately from `vesin` itself. So the message names two things that cannot be installed as written. That gap is not hypothetical. `backend/find_pytorch.py` records the case in its own comment — conda-forge ships `vesin` but not `vesin-torch` — which is exactly an environment where `import vesin` succeeds, `is_vesin_torch_available()` is false, and this message is all the user gets. ## Change The `RuntimeError` now gives commands that resolve it, and points at the extra that ships a backend: ``` SeZM neighbor-list construction requires a neighbor-list backend, but neither 'vesin' nor 'nvalchemiops' is importable. Install one of: pip install 'vesin[torch]' # portable CPU/CUDA cell list pip install nvalchemi-toolkit-ops # batched CUDA kernels 'vesin' also ships with the PyTorch extra: pip install 'deepmd-kit[torch]'. ``` Text only. No dependency, default, or behaviour changes; the selection logic is untouched. `nvalchemi-toolkit-ops` is offered as an alternative rather than recommended: it is a CUDA package restricted to Linux and `python>=3.11`, whereas `vesin[torch]` is portable. ## Tests `source/tests/pt/test_neighbor_backend_missing.py` makes both backends report unavailable and checks that the message names the installable distributions and the extra. Both tests fail against the old message and pass against the new one. ## Note on the no-extra install `pip install deepmd-kit` with no extra — the PyTorch CPU path in `doc/install/easy-install.md` — does **not** reach this message today. `e3nn` sits in the same `torch` extra, and `deepmd/pt/model/descriptor/sezm_nn/projection.py` imports it at module scope, so that install fails earlier with `ModuleNotFoundError: e3nn`. deepmodeling#6036 makes that import lazy; with it applied, the CPU path reaches this message too. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
vesin's torch bindings ship as a separate PyPI package (vesin-torch, pulled in by thevesin[torch]extra). conda-forge packagesvesinbut notvesin-torch, so listingvesin[torch]in the coredependencies(added in #5491) breaks the conda-forge build of the basedeepmd-kitpackage.This moves
vesin[torch]out of the core dependencies and into thetorchoptional-dependency extra (backend/find_pytorch.get_pt_requirement), so onlydeepmd-kit[torch](pip) pulls it. The neighbor-list runtime already guards usage viais_vesin_torch_available(), andnlist_backend="auto"falls back to the native builder when vesin is absent, so this is behavior-preserving for installs that don't ship the torch extra.Changes
pyproject.toml: dropvesin[torch]from coredependencies.backend/find_pytorch.py: addvesin[torch]to thetorchextra.Known limitations
pip install deepmd-kit[torch]resolution and the conda-forge recipe build are not exercised in CI here).torchextra is empty and vesin is not installed (intended).Summary by CodeRabbit