How to convert pip install to Poetry file?
With hours of research, I still can't figure out a way to convert this pip install cmd to pyproject.toml
file. I'm trying to install PyTorch.
pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
This is what I got at the moment (Completely Wrong!)
[tool.poetry]
name = &quot;poetry-test&quot;
version = &quot;0.1.0&quot;
description = &quot;&quot;
authors = [&quot;Your Name &lt;you@example.com&gt;&quot;]

[tool.poetry.dependencies]
python = &quot;^3.8&quot;
torch = &quot;^1.7.0&quot;
torchvision = &quot;^0.8.1&quot;
torchaudio = &quot;^0.7.0&quot;

[tool.poetry.dependencies.torch]
url = &quot;https://download.pytorch.org/whl/torch_stable.html&quot;

[tool.poetry.dev-dependencies]

[build-system]
requires = [&quot;poetry&gt;=0.12&quot;]
build-backend = &quot;poetry.masonry.api&quot;


Previous solution didnt work for me as mentioned in this poetry issue#2543. So what worked for me in the meantime was to upgrade to version 1.2(preview) which addresses that issue.
Install poetry 1.2
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview
Add below repo to your pyproject.toml as suggested here issue#4124, and you shouldnt get version mismatch.
[[tool.poetry.source]]
name = &quot;torch_rep&quot;
url = &quot;https://eternalphane.github.io/pytorch-pypi&quot;

After that, you can just proceed to install them
poetry add torch =1.7.0+cpu
poetry add torchvision=0.8.1+cpu
Alternatively, adding dependencies to pyproject.toml and doing poetry install should also work.
