question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPU package depends on non-CPU torch package

See original GitHub issue

🐛 Bug

The torch-vision CPU wheel depends on the non-CPU torch wheel

Evidence: torchvision-0.6.0+cpu-cp36-cp36m-linux_x86_64.whl\torchvision-0.6.0+cpu.dist-info\METADATA:

Metadata-Version: 2.1
Name: torchvision
Version: 0.6.0+cpu
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Platform: UNKNOWN
Requires-Dist: numpy
Requires-Dist: torch (==1.5.0)           <<<==== PROBLEM ====
Requires-Dist: pillow (>=4.1.1)
Provides-Extra: scipy
Requires-Dist: scipy ; extra == 'scipy'

To Reproduce

I’ve run into this with the poetry package manager for version 1.4.0 and 0.5.0, but the issue is also present in newer versions as can be seen in the previous snippet.

λ poetry lock -vvv                                                                         
Using virtualenv: C:\Users\korij_000\AppData\Local\pypoetry\Cache\virtualenvs\bla-8bWMJ8mE-
py3.6                                                                                      
Updating dependencies                                                                      
Resolving dependencies...                                                                  
   1: fact: bla is 0.1.0                                                                   
   1: derived: bla                                                                         
   1: fact: bla depends on torch (1.4.0+cpu)                                               
   1: fact: bla depends on torchvision (0.5.0+cpu)                                         
   1: selecting bla (0.1.0)                                                                
   1: derived: torchvision (0.5.0+cpu)                                                     
   1: derived: torch (1.4.0+cpu)                                                           
torch: 1 packages found for torchvision 0.5.0+cpu                                          
torch: 1 packages found for torch 1.4.0+cpu                                                
torch: Downloading wheel: torchvision-0.5.0%2Bcpu-cp27-cp27m-linux_x86_64.whl              
   1: fact: torchvision (0.5.0+cpu) depends on numpy (*)                                   
   1: fact: torchvision (0.5.0+cpu) depends on six (*)                                     
   1: fact: torchvision (0.5.0+cpu) depends on torch (1.4.0)                               
   1: fact: torchvision (0.5.0+cpu) depends on pillow (>=4.1.1)                            
   1: derived: pillow (>=4.1.1)                                                            
   1: conflict: torchvision (0.5.0+cpu) depends on torch (1.4.0)      <<<==== PROBLEM ====
   1: ! not torch (1.4.0) is satisfied by torch (1.4.0+cpu)                                
   1: ! which is caused by "bla depends on torch (1.4.0+cpu)"                              
   1: ! thus: torchvision is forbidden                                                     
   1: ! torchvision (0.5.0+cpu) is satisfied by torchvision (0.5.0+cpu)                    
   1: ! which is caused by "bla depends on torchvision (0.5.0+cpu)"                        
   1: ! thus: version solving failed                                                       
   1: Version solving took 1.964 seconds.                                                  
   1: Tried 1 solutions.                                                                   
                                                                                           
[SolverProblemError]                                                                       
Because torchvision (0.5.0+cpu) depends on torch (1.4.0)                                   
 and bla depends on torch (1.4.0+cpu), torchvision is forbidden.                           
So, because bla depends on torchvision (0.5.0+cpu), version solving failed.                

Note that I also had to work around another issue just to get poetry to find these packages since they are not on PyPI. See https://github.com/pytorch/pytorch/issues/39779

Expected behavior

I would expect the CPU wheel for torchvision to depend on the CPU version for torch.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Korijncommented, Jul 9, 2021

I’ve reached the conclusion that the problem lies with poetry’s dependency resolver which appears not to be fully compliant with PEP440. Check out https://github.com/python-poetry/poetry/issues/2543

1reaction
seemetherecommented, Jun 10, 2020

This may also be related to pytorch/pytorch#39779

Related yes but a separate problem. I opened pytorch/pytorch#39779 for that

oh haha,I guess I should’ve noticed that you also filed that originally!

Read more comments on GitHub >

github_iconTop Results From Across the Web

torch.package — PyTorch 1.13 documentation
This module depends on the pickle module which is not secure. Only unpackage data you trust. It is possible to construct malicious pickle...
Read more >
Fastai v1 install issues thread
An obvious solution that would work is to create fastai-cpu conda package that depends on pytorch-nightly-cpu . That actually sounds like a ...
Read more >
How to setup.py my package that depends on PyTorch
I am creating a Python package that depends on PyTorch. ... pip3 install torch==1.8.2+cpu torchvision==0.9.2+cpu torchaudio==0.8.2 -f ...
Read more >
onnxruntime Changelog - pyup.io
CPU usage savings for infrequent inference requests by reducing thread spinning ... ORTModule included as part of OVEP Python Package to enable Torch...
Read more >
TorchSharp 0.99.1 - NuGet
Version Downloads Last updated 0.99.1 953 20 days ago 0.99.0 2,321 a month ago 0.98.3 1,339 2 months ago
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found