Skip to content

meshes.py fails to import in colab notebooks #29

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

Closed
yoDon opened this issue Feb 7, 2020 · 3 comments
Closed

meshes.py fails to import in colab notebooks #29

yoDon opened this issue Feb 7, 2020 · 3 comments

Comments

@yoDon
Copy link

yoDon commented Feb 7, 2020

If you do not know the root cause of the problem / bug, and wish someone to help you, please
post according to this template:

🐛 Bugs / Unexpected behaviors

Instructions To Reproduce the Issue:

  1. Open the Fit Mesh tutorial page
  2. Click the Open in Colab link at the top of the page
  3. Add a cell to install torchvision and pytorch3d as described in the tutorial overview and as corrected in Fix typo in tutorial code markdown #27 (if not yet merged/published)
  4. Run the cell to install torch vision and pytorch3d
  5. Run the cell immediately below 0. Import Modules which includes the line from pytorch3d.structures import Meshes

Expected behavior:

Cell succeeds

Actual behavior:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-14-d743ebcdab4d> in <module>()
      2 import torch
      3 from pytorch3d.io import load_obj, save_obj
----> 4 from pytorch3d.structures import Meshes
      5 from pytorch3d.utils import ico_sphere
      6 from pytorch3d.ops import sample_points_from_meshes

1 frames
/usr/local/lib/python3.6/dist-packages/pytorch3d/structures/meshes.py in <module>()
      4 import torch
      5 
----> 6 from pytorch3d import _C
      7 
      8 from . import utils as struct_utils

ImportError: /usr/local/lib/python3.6/dist-packages/pytorch3d/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Z24RasterizeMeshesNaiveCudaRKN2at6TensorES2_S2_ifib

---------------------------------------------------------------------------
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.
---------------------------------------------------------------------------

Please include the following (depending on what the issue is):

  1. Any changes you made (git diff) or code you wrote
<put diff or code here>
  1. The exact command(s) you ran:
  2. What you observed (including the full logs):
<put logs here>

Please also simplify the steps as much as possible so they do not require additional resources to
run, such as a private dataset.

@sinanmut
Copy link

sinanmut commented Feb 7, 2020

Hi,
I have the same error: ImportError: /usr/local/lib/python3.6/dist-packages/pytorch3d/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Z24RasterizeMeshesNaiveCudaRKN2at6TensorES2_S2_ifib

Is there any solution for this error?
Thanks

@nikhilaravi
Copy link
Contributor

nikhilaravi commented Feb 8, 2020

While we fix the issue in the installation to get unblocked with the colab notebooks, you can use the anaconda cloud package instead of using pip install from github.

Set hardware type

If you want to use a GPU you can change the runtime settings e.g.

Screen Shot 2020-02-07 at 4 11 38 PM Screen Shot 2020-02-07 at 4 11 27 PM

Install PyTorch3d

In the first cell few cells in the colab notebook run the following steps:

  1. Install anaconda cloud
    Either install miniconda
!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh && bash Miniconda3-4.5.4-Linux-x86_64.sh -bfp /usr/local

OR Install Anaconda 3.5

!wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh && bash Anaconda3-5.2.0-Linux-x86_64.sh -bfp /usr/local
  1. Set path:
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
  1. Install pytorch, torchvision and fvcore:
!conda install -c pytorch pytorch torchvision cudatoolkit=10.0
!conda install -c conda-forge -c fvcore fvcore
  1. Install pytorch3d
!conda install pytorch3d -c pytorch3d

We will resolve the issue on master soon. If you still have questions please let us know.

@nikhilaravi
Copy link
Contributor

This is issue now fixed on master so pip install 'git+https://github.com/facebookresearch/pytorch3d.git' will work in a colab notebook.

facebook-github-bot pushed a commit that referenced this issue Nov 5, 2021
Summary:
- Old NDC convention had xy coords in [-1,1]x[-1,1]
- New NDC convention has xy coords in [-1, 1]x[-u, u] or [-u, u]x[-1, 1]

where u > 1 is the aspect ratio of the image.

This PR fixes the NDC raysampler to use the new convention.

Partial fix for #868

Pull Request resolved: fairinternal/pytorch3d#29

Reviewed By: davnov134

Differential Revision: D31926148

Pulled By: bottler

fbshipit-source-id: c6c42c60d1473b04e60ceb49c8c10951ddf03c74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants