-
Notifications
You must be signed in to change notification settings - Fork 2.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
PyTorch Custom Source with Optional Dependencies Not Working with poetry lock
and poetry remove
#10086
Comments
this does not appear in the log that you uploaded |
Sorry, I've updated my log file, and this is the error part: line 2792:
|
does not reproduce. The sequence Maybe put together a dockerfile if you think this can be reproduced |
You're right. I thought the problem was with torch itself. Adding dependencies = [
"pandas~=2.2.3",
"sentence-transformers~=3.3.1", # Added
]
Thank you for following up on the issue. |
if you want to depend on torch from an explicit repository then you need to declare that as a dependency edit: maybe the optional dependency should be enough. But probably it's something to do with the search first encountering torch as a transitive dependency, with no extras set - which torch do you even expect it to choose? I expect that being explicit about what you want is probably the way to get going again anyway |
We are collaborating on our project, and some team members need to install the CPU version while others require the CUDA version. Therefore, we need to specify these as extras. |
most of the torch-is-difficult-to-install issues are a result of torch trying to be too clever with local versions, with multiple indexes, and suchlike. This workaround with extras is at best fragile! Recommend that if you want a long term solution then you should go and petition torch, IMO they should probably be releasing separate packages See also #6409, if you have too much time on your hands |
Description
When using Poetry with PyTorch's custom package sources and optional dependencies, and using
sentence-transformers
library as dependency, thepoetry lock
andpoetry remove
commands fail with "torch not found" errors, even though the package is properly installed and visible viapip list
.When using
poetry install --extras "cuda"
the dependencies will be installed and the lock file will be generated. However, later if we want to usepoetry lock
orpoetry remove <some-package>
we'll receive an error that "torch not found".Current Behavior
Using the following configuration in
pyproject.toml
:When running
poetry install --extras "cuda"
orpoetry install --extras "cpu"
every thing is OK, and the package is properly installed and visible via pip:$ pip list | grep torch torch 2.5.1+cu124
However, when running
poetry lock
orpoetry remove
, I get the following error:Steps to Reproduce
poetry install --extras "cuda"
.poetry lock
orpoetry remove pandas
Workarounds
We should delete lock file every time and use
poetry install --extras "cuda"
agianPoetry Installation Method
Poetry's official installer script
Operating System
Ubuntu 24.04
Poetry Version
2.0.1
Poetry Configuration
Python Sysconfig
sysconfig.log
sysconfigoutput.txt
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
poetrylock.log
The text was updated successfully, but these errors were encountered: