From 4ac20b89582fe9e365d8ec2577d34730dae83e4f Mon Sep 17 00:00:00 2001 From: Nicholas <66370846+nbgit10@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:42:18 +0200 Subject: [PATCH 1/2] Fix poetry lock failure 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. --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 54e6283fc..8c84cd099 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,15 @@ import warnings from typing import List, Optional -import torch +try: + import torch +except ImportError: + import subprocess + import sys + if subprocess.call([sys.executable, "-m", "pip", "install", "torch"]) != 0: + raise RuntimeError("PyTorch not found. Install PyTorch to install PyTorch3D.") + else: + import torch from setuptools import find_packages, setup from torch.utils.cpp_extension import CppExtension, CUDA_HOME, CUDAExtension From 4cdfe25e7de3767059f127cc478a183384dd78e2 Mon Sep 17 00:00:00 2001 From: Nicholas <66370846+nbgit10@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:55:58 +0200 Subject: [PATCH 2/2] Format with black --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 8c84cd099..37a19a1d4 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ except ImportError: import subprocess import sys + if subprocess.call([sys.executable, "-m", "pip", "install", "torch"]) != 0: raise RuntimeError("PyTorch not found. Install PyTorch to install PyTorch3D.") else: