I've recently found poetry
to manage dependencies. In one project, we use PyTorch. How do I add this to poetry
?
We are working on machines that have no access to a CUDA GPU (for simple on the road inferencing/testing) and workstations where we do have access to CUDA GPUs. Is it possible to use poetry to ensure every dev is using the same PyTorch version?
There seems to be no obvious way to decide which PyTorch version to install. I thought about adding the different installation instructions as extra dependencies, but I failed to find an option to get the equivalent settings like:
pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
I would be fine with setting the total path to the different online wheels, like:
https://download.pytorch.org/whl/torch_stable.html/cpu/torch-1.3.1%2Bcpu-cp36-cp36m-win_amd64.whl
But I would rather not but them in git directly... The closest option I've seen in poetry is either downloading them manually and then using file = X
command.
Poetry requires Python 3.7+. It is multi-platform and the goal is to make it work equally well on Linux, macOS and Windows.
Conda and Poetry stand out for currently being the most complete and most used tools by developers. On the one hand, Poetry is a python dependency management and packaging for Python. On the other hand, Conda is a package, dependency, and environment management for any language.
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry replaces setup.py , requirements.
Uninstall Poetry If you decide Poetry isn't your thing, you can completely remove it from your system by running the installer again with the –uninstall option or by setting the POETRY_UNINSTALL environment variable before executing the installer.
Currently, Poetry doesn't have a -f
option (there's an open issue and an open PR), so you can't use the pip
instructions. You can install the .whl
files directly:
poetry add https://download.pytorch.org/whl/torch_stable.html/cpu/torch-1.3.1%2Bcpu-cp36-cp36m-win_amd64.whl
or add the dependency directly to your .toml
file:
[tool.poetry.dependencies]
torch = { url = "https://download.pytorch.org/whl/torch_stable.html/cpu/torch-1.3.1%2Bcpu-cp36-cp36m-win_amd64.whl" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With