marian42 / mesh_to_sdf

Calculate signed distance fields for arbitrary meshes
https://pypi.org/project/mesh-to-sdf/
MIT License
991 stars 107 forks source link

module 'pyglet.gl' has no attribute 'xlib' #8

Closed Xingang1990 closed 4 years ago

Xingang1990 commented 4 years ago

I met with the error when I tried the example codes in the Github document. Could you let me know why?

marian42 commented 4 years ago

This might be a problem related to rendering. What operating system and GPU do you use?

Rouen007 commented 4 years ago

In win10, i got the same error (and mac as well) with PyopenGL 3.1.0 (pyrender 0.1.40) image

Xingang1990 commented 4 years ago

@Rouen007 @marian42 Thank you for your attention and comments. I am also using Mac OS and windows 10. I solved the problem on Mac OS. I found that mesh-to-sdf depends on pyrender and pyrender depends on pyglet. Also the version of pyglet should be 1.4.0b1. See the following link for a detailed explanation. https://pyrender.readthedocs.io/en/latest/install/index.html#python-installation But the latest version of pyrender is 0.1.40 and it requires pyglet version be above 1.5.5 (if my memory works for me well), so pyglet of 1.4.0b1 doesn’t work for it. In addition, it seems that pyrender doesn’t work well in python 3.7 which I used at first. There may be more elegant way to solve this problem. Here is my solution and it works for my Mac. 1. Conda create python 3.6 environment. 2. Conda install pyrender 0.1.30 (older version). 3. Uninstall pyglet (default version came with pyrender). 4. Install pyglet 1.4.0b1 following the instructions of the link above. 5. Don’t forget to install mesh-to-sdf, numpy and other packages for the new environment. 6. Work done. Run the examples of mesh-to-sdf.

Rouen007 commented 4 years ago

@Rouen007 @marian42 Thank you for your attention and comments. I am also using Mac OS and windows 10. I solved the problem on Mac OS. I found that mesh-to-sdf depends on pyrender and pyrender depends on pyglet. Also the version of pyglet should be 1.4.0b1. See the following link for a detailed explanation. https://pyrender.readthedocs.io/en/latest/install/index.html#python-installation But the latest version of pyrender is 0.1.40 and it requires pyglet version be above 1.5.5 (if my memory works for me well), so pyglet of 1.4.0b1 doesn’t work for it. In addition, it seems that pyrender doesn’t work well in python 3.7 which I used at first. There may be more elegant way to solve this problem. Here is my solution and it works for my Mac. 1. Conda create python 3.6 environment. 2. Conda install pyrender 0.1.30 (older version). 3. Uninstall pyglet (default version came with pyrender). 4. Install pyglet 1.4.0b1 following the instructions of the link above. 5. Don’t forget to install mesh-to-sdf, numpy and other packages for the new environment. 6. Work done. Run the examples of mesh-to-sdf.

Thank you very much. And I handle the issue by "pip install mesh-to-sdf numpy PyOpenGL PyOpenGL-accelerate sklearn pyrender==0.1.36 scikit-image==0.15.0" in Python3.6 environment.

Xingang1990 commented 4 years ago

Great! It seems we have identified several alternative ways to solve the problem. Let me close this question.