SPIN icon indicating copy to clipboard operation
SPIN copied to clipboard

issue with colab notebook when running demo.py

Open YoussefAlj opened this issue 5 years ago • 6 comments

Hi,

I have an issue when I try to run the demo.py from googlecolab notebook: when I run the block %%bash python3 demo.py
--checkpoint=data/model_checkpoint.pt
--img=examples/im1010.jpg
--openpose=examples/im1010_openpose.json

this triggers the following error. Any idea to solve this problem? Thanks,

Traceback (most recent call last): File "demo.py", line 28, in from torchvision.transforms import Normalize File "/usr/local/lib/python3.6/dist-packages/torchvision/init.py", line 5, in from torchvision import models File "/usr/local/lib/python3.6/dist-packages/torchvision/models/init.py", line 5, in from .inception import * File "/usr/local/lib/python3.6/dist-packages/torchvision/models/inception.py", line 6, in from torch.jit.annotations import Optional ImportError: cannot import name 'Optional'

YoussefAlj avatar Oct 19 '20 10:10 YoussefAlj

I solved this problem by specifiying trochvision version in the requirements.txt file. Now it looks like this (I also added pillow==6.1.0): neural-renderer-pytorch numpy opencv-python pyopengl pyrender scikit-image scipy==1.0.0 tensorboard chumpy smplx spacepy torch==1.1.0 torchgeometry torchvision==0.3.0 tqdm trimesh pillow==6.1.0

This raises a problem with smpl. So I modified the line 5 in SPIN/models/smpl.py from from smplx.body_models import ModelOutput to from smplx.body_models import SMPLXOutput

Now the problem is I guess with opengl, because I have the following error :

Traceback (most recent call last): File "demo.py", line 36, in from utils.renderer import Renderer File "/content/SPIN/utils/renderer.py", line 6, in import pyrender File "/usr/local/lib/python3.6/dist-packages/pyrender/init.py", line 3, in from .light import Light, PointLight, DirectionalLight, SpotLight File "/usr/local/lib/python3.6/dist-packages/pyrender/light.py", line 10, in from OpenGL.GL import * File "/usr/local/lib/python3.6/dist-packages/OpenGL/GL/init.py", line 4, in from OpenGL.GL.VERSION.GL_1_1 import * File "/usr/local/lib/python3.6/dist-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in from OpenGL.raw.GL.VERSION.GL_1_1 import * File "/usr/local/lib/python3.6/dist-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in from OpenGL.raw.GL import _errors File "/usr/local/lib/python3.6/dist-packages/OpenGL/raw/GL/_errors.py", line 4, in _error_checker = _ErrorChecker( _p, _p.GL.glGetError ) AttributeError: 'NoneType' object has no attribute 'glGetError'

Do you know how to solve this problrem? Regards

YoussefAlj avatar Oct 19 '20 16:10 YoussefAlj

Did you resolve this issue? I was not involved in writing the colab notebook, but it seems there seems to be an issue with OpenGL on your machine. Is our demo.py able to run on your machine?

nkolot avatar Dec 03 '20 11:12 nkolot

Hi! I had a similar problem, and I finally found the solution!

Install torch and torchvision with the following command to make them compatible with Cuda 10.1 on Google Colab (Python 3.7): !pip install torch==1.4.0 torchvision==0.5.0

And follow the instruction here to make Pyrender work with OSMesa: https://pyrender.readthedocs.io/en/latest/install/index.html#osmesa

zonaylc avatar Mar 27 '21 22:03 zonaylc

Hi thanks so much for your feedback! regards,


De : zonaylc @.> Envoyé : samedi 27 mars 2021 23:09 À : nkolot/SPIN @.> Cc : YoussefAlj @.>; Author @.> Objet : Re: [nkolot/SPIN] issue with colab notebook when running demo.py (#93)

Hi! I had a similar problem, and I finally found the solution!

Install torch and torchvision with the following command to make them compatible with Cuda 10.1 on Google Colab (Python 3.7): !pip install torch==1.4.0 torchvision==0.5.0

And follow the install instruction here to make Pyrender work with OSMesa: https://pyrender.readthedocs.io/en/latest/install/index.html#osmesa

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nkolot/SPIN/issues/93#issuecomment-808809410, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABK3Z7CRWADHNKOBDW3QTXTTFZJTNANCNFSM4SV5Q65A.

YoussefAlj avatar Apr 06 '21 11:04 YoussefAlj

Hi, I have the same problem. My os is Ubuntu16.04 and CUDA=10.0, and I have install pip install torch==1.1.0 torchvision==0.3.0.

Error Trace is : Traceback (most recent call last): File "demo.py", line 36, in from utils.renderer import Renderer File "/home/ubuntu/mahui/SPIN/utils/renderer.py", line 6, in import pyrender File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/pyrender/init.py", line 3, in from .light import Light, PointLight, DirectionalLight, SpotLight File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/pyrender/light.py", line 10, in from OpenGL.GL import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/GL/init.py", line 4, in from OpenGL.GL.VERSION.GL_1_1 import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in from OpenGL.raw.GL.VERSION.GL_1_1 import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in from OpenGL.raw.GL import _errors File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/raw/GL/_errors.py", line 4, in _error_checker = _ErrorChecker( _p, _p.GL.glGetError ) AttributeError: 'NoneType' object has no attribute 'glGetError'

which vision of torch should I download?

mahui97 avatar Oct 28 '21 09:10 mahui97

Hi, I have the same problem. My os is Ubuntu16.04 and CUDA=10.0, and I have install pip install torch==1.1.0 torchvision==0.3.0.

Error Trace is : Traceback (most recent call last): File "demo.py", line 36, in from utils.renderer import Renderer File "/home/ubuntu/mahui/SPIN/utils/renderer.py", line 6, in import pyrender File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/pyrender/init.py", line 3, in from .light import Light, PointLight, DirectionalLight, SpotLight File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/pyrender/light.py", line 10, in from OpenGL.GL import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/GL/init.py", line 4, in from OpenGL.GL.VERSION.GL_1_1 import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in from OpenGL.raw.GL.VERSION.GL_1_1 import * File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in from OpenGL.raw.GL import _errors File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/OpenGL/raw/GL/_errors.py", line 4, in _error_checker = _ErrorChecker( _p, _p.GL.glGetError ) AttributeError: 'NoneType' object has no attribute 'glGetError'

which vision of torch should I download?

and I test pip install torch==1.2.0 torchvision==0.4.0, but it also had no effect.

mahui97 avatar Oct 28 '21 09:10 mahui97