Closed nbgit10 closed 1 year ago
As discussed before, e.g. on https://github.com/facebookresearch/pytorch3d/pull/1479, we aren't likely to add anything to pytorch3d which automatically installs torch anytime soon.
How this fits with poetry is something we are interested in getting advice about.
I am installing pytorch3d from source and have added it to my pyproject.toml
simply with pytorch3d = {git = "git@github.com:facebookresearch/pytorch3d.git", tag = "stable"}
. When updating/creating the poetry.lock
file by running poetry lock
Poetry runs through the setup.py
of pytorch3d which fails due to torch not being installed. This happens if a new venv needs to be created. If poetry can find a venv of the project and it already has torch installed, it works. However, even if, for example, the system Python environment has torch available, a newly created venv has not.
I think in the end it is the same issue as https://github.com/facebookresearch/pytorch3d/issues/1419
Switching to a pyproject.toml
file and adding torch>=1.10
as a build requirement would solve this and is much less hacky than my change proposed here.
Interestingly, it does not help if I add torch as a build requirement in my project, where pytorch3d
is a regular dependency. I am not deep enough in the various PEP standards to know if this behaviour is as designed but it is unfortunately not a suitable workaround. So actually this is independent of poetry but actually affects any install from-source in a clean environment.
Poetry lock fails with pytorch3d as dependency because the resolver runs in a dedicated, clean venv on every run. Therefore,
import torch
fails in pytorch3d'ssetup.py
and we need to install it while resolving dependencies.I believe this is a bug that anyone using poetry would have when specifying pytorch3d as a dependency in their
pyproject.toml
file - at least when installing directly from source.