Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix poetry lock fails #1619

Closed
wants to merge 2 commits into from
Closed

Conversation

nbgit10
Copy link

@nbgit10 nbgit10 commented Aug 24, 2023

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's setup.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.

Poetry lock fails with pytorch3d as dependency because the resolver runs in a dedicated, clean venv on every run. Therefore, torch import fails and needs to be installed for poetry to resolve dependencies.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 24, 2023
@bottler
Copy link
Contributor

bottler commented Aug 24, 2023

As discussed before, e.g. on #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.

@nbgit10
Copy link
Author

nbgit10 commented Aug 25, 2023

I am installing pytorch3d from source and have added it to my pyproject.toml simply with pytorch3d = {git = "[email protected]: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.

@nbgit10
Copy link
Author

nbgit10 commented Aug 25, 2023

I think in the end it is the same issue as #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants