facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.7k stars 1.3k forks source link

PyTorch3D Colab Tutorials - Cannot Install PyTorch3D #1701

Closed JuliaWiercigroch closed 9 months ago

JuliaWiercigroch commented 9 months ago

PyTorch3D installation on Google Colab is not working - running tutorial code leads to errors.

Instructions To Reproduce the Issue:

Opened a PyTorch3D Colab tutorial (such as from here and tried to install PyTorch3D with the given code.

import os
import sys
import torch
need_pytorch3d=False
try:
    import pytorch3d
except ModuleNotFoundError:
    need_pytorch3d=True
if need_pytorch3d:
    if torch.__version__.startswith("2.1.") and sys.platform.startswith("linux"):
        # We try to install PyTorch3D via a released wheel.
        pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
        version_str="".join([
            f"py3{sys.version_info.minor}_cu",
            torch.version.cuda.replace(".",""),
            f"_pyt{pyt_version_str}"
        ])
        !pip install fvcore iopath
        !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
    else:
        # We try to install PyTorch3D from source.
        !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'

Result from Colab:

Looking in links: https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py310_cu121_pyt210/download.html
ERROR: Could not find a version that satisfies the requirement pytorch3d (from versions: none)
ERROR: No matching distribution found for pytorch3d

Tried installing PyTorch3D from source but building wheel took too much time (over 10 min before I manually stopped process). Same errors with using the code in README.md doc.

JPPPPPF commented 9 months ago

same issue, @bottler would you mind assisting in this please? as far as I noticed from previous issues you remove the old wheels and add new ones for the current versions of dependencies used by colab, correct?

Any help is appreciated here, thank you

lorenzosoannini commented 9 months ago

I solved reinstalling torch with cuda 11.8, the wheels for cuda 12 (now used in colab) are missing

JPPPPPF commented 9 months ago

Hello @lorenzosoannini, can u please send me the code to do that?

lorenzosoannini commented 9 months ago

Hello @lorenzosoannini, can u please send me the code to do that?

if torch.version.cuda != "11.8": !pip3 uninstall -y torch torchvision torchaudio !pip3 install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

bottler commented 9 months ago

This went wrong because colab updated from CUDA 11.8 to CUDA 12.1 and packages had not been prepared. I've now uploaded linux wheels for Python 3.10 with Cuda 12.1 with PyTorch 2.1.0, 2.1.1 and 2.1.2 and the tutorials are working again.