【发布时间】:2021-10-23 19:22:54
【问题描述】:
我正在尝试使用诗歌为机器学习创建一个虚拟环境。所以,我使用 pytorch 作为深度学习的框架。我将提取我的 pyproject.toml 的相关部分。
[tool.poetry.dependencies].
python = "^3.8"
torch = { url = "https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp38-cp38-linux_x86_64.whl"}
torchvision = { url = "https://download.pytorch.org/whl/cu111/torchvision-0.9.0%2Bcu111-cp38-cp38-linux_x86_64.whl" }
由于pytroch使用GPU,需要通过指定whl文件来安装。如果以这种方式安装,pytroch 的版本将是1.8.0+cu111。 torchvision对应pytorch的1.8.0就是0.9.0。这个torchvision 所依赖的pytroch 版本是1.8.0(没有cu111)。因此,我无法使用诗歌创建虚拟环境,出现以下错误。
SolverProblemError
Because torchvision (0.9.0) depends on torch (1.8.0)
and mdwithpriorenergy depends on torch (1.8.0+cu111), torchvision is forbidden.
So, because mdwithpriorenergy depends on torchvision (0.9.0), version solving failed.
So, because [env name] depends on torchvision (0.9.0), version solving failed.
我还对上面pyproject.toml中的torchvision进行了以下更改,但没有奏效。
[tool.poetry.dependencies].
python = "^3.8"
torch = { url = "https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp38-cp38-linux_x86_64.whl"}
- torchvision = { url = "https://download.pytorch.org/whl/cu111/torchvision-0.9.0%2Bcu111-cp38-cp38-linux_x86_64.whl"}
+ torchvision = "*"
在这种情况下,我收到以下错误
AttributeError
'EmptyConstraint' object has no attribute 'allows'.
请告诉我如何解决这个错误。
【问题讨论】:
标签: python pytorch gpu python-poetry