pytorch 在python中安装ultralytics时出错,因为它们具有冲突的依赖关系

i1icjdpr  于 2023-02-12  发布在  Python
关注(0)|答案(1)|浏览(5902)

我尝试在可视化环境中安装ultralytics,但收到以下错误消息:

pip install ultralytics
Collecting ultralytics
  Using cached ultralytics-8.0.6-py3-none-any.whl (251 kB)
Collecting hydra-core>=1.2.0
  Using cached hydra_core-1.3.1-py3-none-any.whl (154 kB)
Collecting matplotlib>=3.2.2
  Using cached matplotlib-3.6.3-cp311-cp311-win_amd64.whl (7.2 MB)
Collecting numpy>=1.18.5
  Using cached numpy-1.24.2-cp311-cp311-win_amd64.whl (14.8 MB)
Collecting opencv-python>=4.1.1
  Using cached opencv_python-4.7.0.68-cp37-abi3-win_amd64.whl (38.2 MB)
Collecting Pillow>=7.1.2
  Using cached Pillow-9.4.0-cp311-cp311-win_amd64.whl (2.5 MB)
Collecting PyYAML>=5.3.1
  Using cached PyYAML-6.0-cp311-cp311-win_amd64.whl (143 kB)
Collecting requests>=2.23.0
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting scipy>=1.4.1
  Using cached scipy-1.10.0-cp311-cp311-win_amd64.whl (42.2 MB)
Collecting ultralytics
  Using cached ultralytics-8.0.5-py3-none-any.whl (248 kB)
  Using cached ultralytics-8.0.4-py3-none-any.whl (248 kB)
  Using cached ultralytics-8.0.3-py3-none-any.whl (247 kB)
  Using cached ultralytics-8.0.2-py3-none-any.whl (224 kB)
  Using cached ultralytics-8.0.1-py3-none-any.whl (225 kB)
  Using cached ultralytics-8.0.0-py3-none-any.whl (219 kB)
  Using cached ultralytics-0.0.44-py3-none-any.whl (16 kB)
Collecting GitPython>=3.1.24
  Using cached GitPython-3.1.30-py3-none-any.whl (184 kB)
Collecting ultralytics
  Using cached ultralytics-0.0.43-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.42-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.41-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.40-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.39-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.38-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.37-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.36-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.35-py3-none-any.whl (16 kB)
  Using cached ultralytics-0.0.34-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.33-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.32-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.31-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.30-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.29-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.28-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.27-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.26-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.25-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.24-py3-none-any.whl (15 kB)
  Using cached ultralytics-0.0.23-py3-none-any.whl (14 kB)
  Using cached ultralytics-0.0.22-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.21-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.20-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.19-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.18-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.17-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.16-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.15-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.14-py3-none-any.whl (13 kB)
  Using cached ultralytics-0.0.13-py3-none-any.whl (13 kB)
ERROR: Cannot install ultralytics==0.0.13, ultralytics==0.0.14, ultralytics==0.0.15, ultralytics==0.0.16, ultralytics==0.0.17, ultralytics==0.0.18, ultralytics==0.0.19, ultralytics==0.0.20, ultralytics==0.0.21, ultralytics==0.0.22, ultralytics==0.0.23, ultralytics==0.0.24, ultralytics==0.0.25, ultralytics==0.0.26, ultralytics==0.0.27, ultralytics==0.0.28, ultralytics==0.0.29, ultralytics==0.0.30, ultralytics==0.0.31, ultralytics==0.0.32, ultralytics==0.0.33, ultralytics==0.0.34, ultralytics==0.0.35, ultralytics==0.0.36, ultralytics==0.0.37, ultralytics==0.0.38, ultralytics==0.0.39, ultralytics==0.0.40, ultralytics==0.0.41, ultralytics==0.0.42, ultralytics==0.0.43, ultralytics==0.0.44, ultralytics==8.0.0, ultralytics==8.0.1, ultralytics==8.0.2, ultralytics==8.0.3, ultralytics==8.0.4, ultralytics==8.0.5 and ultralytics==8.0.6 because these package versions have conflicting dependencies.

The conflict is caused by:
    ultralytics 8.0.6 depends on torch>=1.7.0
    ultralytics 8.0.5 depends on torch>=1.7.0
    ultralytics 8.0.4 depends on torch>=1.7.0
    ultralytics 8.0.3 depends on torch>=1.7.0
    ultralytics 8.0.2 depends on torch>=1.7.0
    ultralytics 8.0.1 depends on torch>=1.7.0
    ultralytics 8.0.0 depends on torch>=1.7.0
    ultralytics 0.0.44 depends on torch>=1.7.0
    ultralytics 0.0.43 depends on torch>=1.7.0
    ultralytics 0.0.42 depends on torch>=1.7.0
    ultralytics 0.0.41 depends on torch>=1.7.0
    ultralytics 0.0.40 depends on torch>=1.7.0
    ultralytics 0.0.39 depends on torch>=1.7.0
    ultralytics 0.0.38 depends on torch>=1.7.0
    ultralytics 0.0.37 depends on torch>=1.7.0
    ultralytics 0.0.36 depends on torch>=1.7.0
    ultralytics 0.0.35 depends on torch>=1.7.0
    ultralytics 0.0.34 depends on torch>=1.7.0
    ultralytics 0.0.33 depends on torch>=1.7.0
    ultralytics 0.0.32 depends on torch>=1.7.0
    ultralytics 0.0.31 depends on torch>=1.7.0
    ultralytics 0.0.30 depends on torch>=1.7.0
    ultralytics 0.0.29 depends on torch>=1.7.0
    ultralytics 0.0.28 depends on torch>=1.7.0
    ultralytics 0.0.27 depends on torch>=1.7.0
    ultralytics 0.0.26 depends on torch>=1.7.0
    ultralytics 0.0.25 depends on torch>=1.7.0
    ultralytics 0.0.24 depends on torch>=1.7.0
    ultralytics 0.0.23 depends on torch>=1.7.0
    ultralytics 0.0.22 depends on torch>=1.7.0
    ultralytics 0.0.21 depends on torch>=1.7.0
    ultralytics 0.0.20 depends on torch>=1.7.0
    ultralytics 0.0.19 depends on torch>=1.7.0
    ultralytics 0.0.18 depends on torch>=1.7.0
    ultralytics 0.0.17 depends on torch>=1.7.0
    ultralytics 0.0.16 depends on torch>=1.7.0
    ultralytics 0.0.15 depends on torch>=1.7.0
    ultralytics 0.0.14 depends on torch>=1.7.0
    ultralytics 0.0.13 depends on torch>=1.7.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

当我尝试手动安装pytorch时,我收到以下错误:

pip install torch   
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

如何解决此问题?

mqkwyuun

mqkwyuun1#

这个问题可能与您使用的Python版本有关,documentation linkhttps://pypi.org/project/ultralytics/)表明(在编写本文时)ultralytics包只支持Python 3.7,包括Python 3.10。
编辑:我看到文档的左栏说应该支持Python 3. 11,但是在DocumentationInstall下提到了我最初回答中的信息。

相关问题