facebookresearch / pifuhd

High-Resolution 3D Human Digitization from A Single Image.
Other
9.5k stars 1.44k forks source link

Error in google colab notebook #77

Closed abhijeetmanhas closed 3 years ago

abhijeetmanhas commented 3 years ago

It was running fine, just 2-3 hours ago, but isn't working now. Probably there has been some updates on the github repositories used in this notebook.

Complete error log:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-14-22614b7ef849> in <module>()
----> 1 from lib.colab_util import generate_video_from_obj, set_renderer, video
      2 
      3 renderer = set_renderer()
      4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer)
      5 

4 frames
/content/pifuhd/lib/colab_util.py in <module>()
     33 
     34 # Util function for loading meshes
---> 35 from pytorch3d.io import load_objs_as_meshes
     36 
     37 from IPython.display import HTML

/usr/local/lib/python3.6/dist-packages/pytorch3d/io/__init__.py in <module>()
      2 
      3 
----> 4 from .obj_io import load_obj, load_objs_as_meshes, save_obj
      5 from .ply_io import load_ply, save_ply
      6 

/usr/local/lib/python3.6/dist-packages/pytorch3d/io/obj_io.py in <module>()
     12 from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas
     13 from pytorch3d.io.utils import _check_faces_indices, _make_tensor, _open_file
---> 14 from pytorch3d.renderer import TexturesAtlas, TexturesUV
     15 from pytorch3d.structures import Meshes, join_meshes_as_batch
     16

/usr/local/lib/python3.6/dist-packages/pytorch3d/renderer/__init__.py in <module>()
      1 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
      2 
----> 3 from .blending import (
      4     BlendParams,
      5     hard_rgb_blend,

/usr/local/lib/python3.6/dist-packages/pytorch3d/renderer/blending.py in <module>()
      7 
      8 # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
----> 9 from pytorch3d import _C
     10 
     11 

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

---------------------------------------------------------------------------
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.
--------------------------------------------------------------------------- 
FlashlightET commented 3 years ago

same here

shunsukesaito commented 3 years ago

I found that default pytorch version on Google Colab is updated to 1.7.0 and the current pip package only supports pytorch 1.6 with cuda. I guess pip package will be updated at some point but tentative fix would be either forcing google colab to use Pytorch 1.6 reference or compiling pytorch3d from source code !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable' , which is slow...

A relevant issue is here. https://github.com/facebookresearch/pytorch3d/issues/339

ssssssssssss commented 3 years ago

!pip install 'torch==1.6.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'torchvision==0.7.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'pytorch3d==0.2.5'

Please install this version instead the in-stock versions

innat commented 3 years ago

Though I install the above version at the very beginning, the error is still throwing. Any catch?

abhijeetmanhas commented 3 years ago

Remove the line which is installing pytorch3D again

On 11 Nov 2020 20:03, "Mohammed Innat" notifications@github.com wrote:

Though I install the above version at the very beginning, the error is still throwing. Any catch?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/facebookresearch/pifuhd/issues/77#issuecomment-725456332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKI5PG7EXVH5ELZC4UGRWRDSPKOCPANCNFSM4TKNLNKQ .

Sdfabio commented 3 years ago

Any help for this error ?

mkskalai commented 3 years ago

I solved the problem by following the INSTALL.md instructions of pytorch3d but installing cuda 10.1 instead of 10.2:

conda install -c pytorch pytorch=1.7.0 torchvision cudatoolkit=10.1

everything else just like in the instructions

alex-treebeard commented 3 years ago

I've just released nbmake which maintainers may find helpful here

shunsukesaito commented 3 years ago

I updated the comments in the google colab with two tentative fixes.

TheDevelolper commented 3 years ago

@shunsukesaito the fixes in the Google Colab do not seem to work.

I tried this but I'm still getting the same error:

!pip install 'torch==1.6.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html
!pip install 'torchvision==0.7.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html
!pip install 'pytorch3d==0.2.5'

# If you get an error in the next cell, you can instead try the following command (don't forget to comment out the one above!).
# Note that this error is caused by inconsistent cuda version for the pytorch3d package and pytorch in Colab environment.
# Thus, this issue may persist unless pytorch3d in the pip package is updated with the cuda version consistent with pytorch in Colab.
# Also please be aware that the following command is much slower as it builds pytorch3d from scratch.

# !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'

# You can try another solution below as well. This is also slow and requires you to restart the runtime.

# !pip install 'torch==1.6.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html
# !pip install 'torchvision==0.7.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html
# !pip install 'pytorch3d==0.2.5

error:

ImportError                               Traceback (most recent call last)
<ipython-input-22-22614b7ef849> in <module>()
----> 1 from lib.colab_util import generate_video_from_obj, set_renderer, video
      2 
      3 renderer = set_renderer()
      4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer)
      5 

4 frames
/usr/local/lib/python3.7/dist-packages/pytorch3d/renderer/blending.py in <module>()
      7 
      8 # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
----> 9 from pytorch3d import _C
     10 
     11 

ImportError: /usr/local/lib/python3.7/dist-packages/pytorch3d/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7is_cudaEv

---------------------------------------------------------------------------
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.
---------------------------------------------------------------------------
ne1114 commented 2 years ago

^ Same here

thuanha-groove commented 2 years ago

@FacePalmDev you have to restart the runtime to make it work

ChenChihYuan commented 2 years ago

I am having the same issue, and have already tried to pip the alternative 3 lines. Still failed. Really cool project. Any idea about how to fix it? I am not that familiar with colab. Thanks

ChenChihYuan commented 2 years ago

Sorry for the comment above. I am quite new with colab. With this https://www.youtube.com/watch?v=WjvM3FcpId4&t=0s tutorial video, I understand how to make it works. The rendering parts should be changed to

!pip install 'torch==1.6.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'torchvision==0.7.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'pytorch3d==0.2.5'

Please install this version instead the in-stock versions

and ALSO we need to restart the runtime.

The other colab scripts provided by the youtuber mentioned above. Basically he did the same thing.

https://colab.research.google.com/github/derekphilipau/machinelearningforartists/blob/main/PIFuHD_Demo.ipynb

One small bug I had was in the upload file part, there's not pop-up window asking for photo path. And the reason is I am currently using Brave the browser.

In case someone have the same experience as I did.

GabrielLunesu commented 2 years ago

Sorry for the comment above. I am quite new with colab. With this https://www.youtube.com/watch?v=WjvM3FcpId4&t=0s tutorial video, I understand how to make it works. The rendering parts should be changed to

!pip install 'torch==1.6.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'torchvision==0.7.0+cu101' -f https://download.pytorch.org/whl/torch_stable.html !pip install 'pytorch3d==0.2.5' Please install this version instead the in-stock versions

and ALSO we need to restart the runtime.

The other colab scripts provided by the youtuber mentioned above. Basically he did the same thing.

https://colab.research.google.com/github/derekphilipau/machinelearningforartists/blob/main/PIFuHD_Demo.ipynb

One small bug I had was in the upload file part, there's not pop-up window asking for photo path. And the reason is I am currently using Brave the browser.

In case someone have the same experience as I did.

""ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. torchvision 0.11.1+cu111 requires torch==1.10.0, but you have torch 1.6.0+cu101 which is incompatible. torchtext 0.11.0 requires torch==1.10.0, but you have torch 1.6.0+cu101 which is incompatible. torchaudio 0.10.0+cu111 requires torch==1.10.0, but you have torch 1.6.0+cu101 which is incompatible. Successfully installed torch-1.6.0+cu101 ERROR: Invalid requirement: '!pip' ""

why do i get this?

aaparikh commented 1 year ago

Even after following the mentioned steps, I am getting the following error. Please help me out.


ModuleNotFoundError Traceback (most recent call last) in ----> 1 from lib.colab_util import generate_video_from_obj, set_renderer, video 2 3 renderer = set_renderer() 4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer) 5

ModuleNotFoundError: No module named 'lib'


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

Please explain what is lib.colab_util ?

Manojooo7 commented 1 year ago

https://github.com/facebookresearch/pifuhd/issues/77#issuecomment-879028167

I'm Also facing the same error i try all suggestion given below but the error didn't solved so please help me to figure out the solution

innat commented 1 year ago

@shunsukesaito Please take a look into this issue.

spiritwhispers commented 1 year ago

Did you guys figure anything out on this issue. I am stuck and don't know what to do. Thanks.

Manojooo7 commented 1 year ago

Sorry didn't find anything