diff --git a/docs/tutorials/bundle_adjustment.ipynb b/docs/tutorials/bundle_adjustment.ipynb index add5e405..04b2b60b 100644 --- a/docs/tutorials/bundle_adjustment.ipynb +++ b/docs/tutorials/bundle_adjustment.ipynb @@ -83,25 +83,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb b/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb index 9b9fe593..e230ba52 100644 --- a/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb +++ b/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb @@ -70,25 +70,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb b/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb index 8c09e6b5..09a61d44 100644 --- a/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb +++ b/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb @@ -45,25 +45,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb b/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb index a001b47e..6f536f5b 100644 --- a/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb +++ b/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb @@ -84,25 +84,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/fit_simple_neural_radiance_field.ipynb b/docs/tutorials/fit_simple_neural_radiance_field.ipynb index c8880e41..54665050 100644 --- a/docs/tutorials/fit_simple_neural_radiance_field.ipynb +++ b/docs/tutorials/fit_simple_neural_radiance_field.ipynb @@ -50,25 +50,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/fit_textured_mesh.ipynb b/docs/tutorials/fit_textured_mesh.ipynb index 92efbc65..7813150b 100644 --- a/docs/tutorials/fit_textured_mesh.ipynb +++ b/docs/tutorials/fit_textured_mesh.ipynb @@ -62,25 +62,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/fit_textured_volume.ipynb b/docs/tutorials/fit_textured_volume.ipynb index d857bc29..cc147925 100644 --- a/docs/tutorials/fit_textured_volume.ipynb +++ b/docs/tutorials/fit_textured_volume.ipynb @@ -41,25 +41,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/implicitron_config_system.ipynb b/docs/tutorials/implicitron_config_system.ipynb index d39942ee..2745b205 100644 --- a/docs/tutorials/implicitron_config_system.ipynb +++ b/docs/tutorials/implicitron_config_system.ipynb @@ -72,25 +72,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/implicitron_volumes.ipynb b/docs/tutorials/implicitron_volumes.ipynb index 1f387619..e1ff0d71 100644 --- a/docs/tutorials/implicitron_volumes.ipynb +++ b/docs/tutorials/implicitron_volumes.ipynb @@ -66,25 +66,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/render_colored_points.ipynb b/docs/tutorials/render_colored_points.ipynb index 2ed0b99e..3e3eadd1 100644 --- a/docs/tutorials/render_colored_points.ipynb +++ b/docs/tutorials/render_colored_points.ipynb @@ -44,25 +44,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/render_densepose.ipynb b/docs/tutorials/render_densepose.ipynb index cfe1f0eb..36b4388a 100644 --- a/docs/tutorials/render_densepose.ipynb +++ b/docs/tutorials/render_densepose.ipynb @@ -51,25 +51,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, { diff --git a/docs/tutorials/render_textured_meshes.ipynb b/docs/tutorials/render_textured_meshes.ipynb index daf90c8b..5cf36189 100644 --- a/docs/tutorials/render_textured_meshes.ipynb +++ b/docs/tutorials/render_textured_meshes.ipynb @@ -67,25 +67,31 @@ "import os\n", "import sys\n", "import torch\n", + "import subprocess\n", "need_pytorch3d=False\n", "try:\n", " import pytorch3d\n", "except ModuleNotFoundError:\n", " need_pytorch3d=True\n", "if need_pytorch3d:\n", - " if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n", - " # We try to install PyTorch3D via a released wheel.\n", - " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", - " version_str=\"\".join([\n", - " f\"py3{sys.version_info.minor}_cu\",\n", - " torch.version.cuda.replace(\".\",\"\"),\n", - " f\"_pyt{pyt_version_str}\"\n", - " ])\n", - " !pip install fvcore iopath\n", + " pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n", + " version_str=\"\".join([\n", + " f\"py3{sys.version_info.minor}_cu\",\n", + " torch.version.cuda.replace(\".\",\"\"),\n", + " f\"_pyt{pyt_version_str}\"\n", + " ])\n", + " !pip install fvcore iopath\n", + " if sys.platform.startswith(\"linux\"):\n", + " print(\"Trying to install wheel for PyTorch3D\")\n", " !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n", - " else:\n", - " # We try to install PyTorch3D from source.\n", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " pip_list = !pip freeze\n", + " need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n", + " if need_pytorch3d:\n", + " print(f\"failed to find/install wheel for {version_str}\")\n", + "if need_pytorch3d:\n", + " print(\"Installing PyTorch3D from source\")\n", + " !pip install ninja\n", + " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" ] }, {