zju3dv / EasyMocap

Make human motion capture easier.
Other
3.47k stars 442 forks source link

pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None" #149

Closed LuPaoPao closed 2 years ago

LuPaoPao commented 2 years ago

Acording quickstar, but get some issue,hope for your reply: File "apps/demo/mv1p.py", line 119, in mv1pmf_smpl(dataset, args) File "apps/demo/mv1p.py", line 90, in mv1pmf_smpl dataset.vis_smpl(vertices=vertices[0], faces=body_model.faces, images=images, nf=nf, sub_vis=args.sub_vis, add_back=True) File "/home/luhao03/Data/niuxuesong/luhao_share/Code/Refer/EasyMocap-master/easymocap/dataset/mv1pmf.py", line 47, in vis_smpl self.writer.vis_smpl(render_data, images, cameras, outname, add_back=add_back) File "/home/luhao03/Data/niuxuesong/luhao_share/Code/Refer/EasyMocap-master/easymocap/mytools/writer.py", line 73, in vis_smpl render = Renderer(height=1024, width=1024, faces=None) File "/home/luhao03/Data/niuxuesong/luhao_share/Code/Refer/EasyMocap-master/easymocap/visualize/renderer.py", line 85, in init self.renderer = pyrender.OffscreenRenderer(height, width) File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in init self._create() File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyrender/offscreen.py", line 149, in _create self._platform.init_context() File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py", line 52, in init_context width=1, height=1) File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyglet/window/xlib/init.py", line 171, in init super(XlibWindow, self).init(*args, **kwargs) File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyglet/window/init.py", line 590, in init display = pyglet.canvas.get_display() File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyglet/canvas/init.py", line 94, in get_display return Display() File "/root/miniconda/envs/py37/lib/python3.7/site-packages/pyglet/canvas/xlib.py", line 123, in init raise NoSuchDisplayException('Cannot connect to "%s"' % name) pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

chingswy commented 2 years ago

If you meet some errors like pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None", you must run this code on a server. You should follow this tutorial.

Install pyrender in a server:

  1. Install osmesa with sudo
sudo apt update
sudo wget https://github.com/mmatl/travis_debs/raw/master/xenial/mesa_18.3.3-0.deb
sudo dpkg -i ./mesa_18.3.3-0.deb || true
sudo apt install -f
  1. Install pyopengl
mkdir -p 3rdparty
cd 3rdparty
git clone https://github.com/mmatl/pyopengl.git
python3 -m pip uninstall pyopengl
python3 -m pip install ./pyopengl
# add osmesa to environment variable
echo "export PYOPENGL_PLATFORM=osmesa" >> ~/.zshrc
export PYOPENGL_PLATFORM=osmesa

You must run export PYOPENGL_PLATFORM=osmesa once before you run any code on a server.

StefanoBraghetto commented 1 year ago

@LuPaoPao , could you solve the problem.

i'm getting pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None" and did what @chingswy said but still having the problem.

i leave here a colab showing my entire code:

https://colab.research.google.com/drive/1lftnrpHNNjdJWHo6Pg6XRrdbuCWjbjYe?usp=sharing

Thanks