Pytorch3d: In render_colored_points.ipynb .vis - no Module named

Created on 16 Oct 2020  ·  8Comments  ·  Source: facebookresearch/pytorch3d

🐛 Bugs / Unexpected behavior

On the tutorial https://github.com/facebookresearch/pytorch3d/blob/master/docs/tutorials/render_colored_points.ipynb, now that the name has changed from "visualization' to 'vis' there is a _ModuleNotFoundError: No module named 'pytorch3d.vis'_

Instructions To Reproduce the Issue:

<import os
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
from skimage.io import imread

import numpy as np

from pytorch3d.structures import Pointclouds
from pytorch3d.vis import AxisArgs, plot_pointclouds
from pytorch3d.renderer import (
    look_at_view_transform,
    FoVOrthographicCameras, 
    PointsRasterizationSettings,
    PointsRenderer,
    PointsRasterizer,
    AlphaCompositor,
    NormWeightedCompositor
)>
  1. Any changes you made (git diff) or code you wrote
    I saw this commit https://github.com/facebookresearch/pytorch3d/commit/5d65a0cf8c9a1fb755fd09ce098bcedb0c670d80#diff-9ff2a09cd7b2a583e030b1aa0376b3ce7d8a39723e098e1b4e727487fd1bf279 so I changed to
<from pytorch3d.visualization import AxisArgs, plot_pointclouds>
  1. But still same error
<ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-445b2bac4bbb> in <module>()
     10 # Data structures and functions for rendering
     11 from pytorch3d.structures import Pointclouds
---> 12 from pytorch3d.visualization import AxisArgs, plot_pointclouds
     13 from pytorch3d.renderer import (
     14     look_at_view_transform,

ModuleNotFoundError: No module named 'pytorch3d.visualization'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.>
question

Most helpful comment

@DuaneNielsen @albertotono ok I will take a look at this and get back to you!

All 8 comments

Are you running the tutorial after cloning the github repo or on Colab? It depends how you are installing PyTorch3D. The conda packages do not have the vis module.

Thanks @nikhilaravi for the quick reply.
I using from Google Colab,
I run this before for installing pytorch3d, from the stable as reported in the tutorial

!pip install torch torchvision
import sys
import torch
if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):
    !pip install pytorch3d
else:
    !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'

As explained in https://github.com/facebookresearch/pytorch3d/issues/385#issuecomment-704485523, we have several experimental features in the master branch but not in the conda package - the stable tag references the commit which was used to build the conda package. If you want to use the code available in master you need to remove the @stable tag at the end of the pip install command.

Thanks @nikhilaravi for the reference, it didn't appear on my initial search unfortunately

I followed your suggestion and I used only this line

!pip install 'git+https://github.com/facebookresearch/pytorch3d.git' instead of the usual

!pip install torch torchvision
import sys
import torch
if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):
    !pip install pytorch3d
else:
    !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'

it took around 7min

and then Successfully built pytorch3d

unfortunately I still have the same error

ModuleNotFoundError: No module named 'pytorch3d.vis'

I tried also with .visualization but same error

Looking at 0.2.5, which as of today is the version currently in pypi

https://github.com/facebookresearch/pytorch3d/tree/v0.2.5/pytorch3d

v0.2.5 definately does not contain pytorch3d.vis

building from source using pip also didn't work for me

@DuaneNielsen @albertotono ok I will take a look at this and get back to you!

The change was from pytorch3d.visualization to pytorch3d.vis, not the other way around.

I think there's something strange about pip installing from github in to colab. Several times, I tried

!pip install 'git+https://github.com/facebookresearch/pytorch3d.git'
from pytorch3d.vis import AxisArgs, plot_pointclouds

in a blank colab notebook. It should work, and it usually did, but it did raise your error once, maybe due to a caching issue.

Can you maybe restart and try again?

Thank you all, confirmed that restarting the runtime didn't work , but using a new notebook worked perfectly! I am closing this issue. Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TSKongLingwei picture TSKongLingwei  ·  3Comments

TheshowN picture TheshowN  ·  3Comments

aluo-x picture aluo-x  ·  3Comments

unlugi picture unlugi  ·  3Comments

AndreiBarsan picture AndreiBarsan  ·  3Comments