krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
377 stars 96 forks source link

Unable to import `klampt.viz` on Ubuntu 22.04 due to GLUT import error #150

Closed jstmn closed 2 years ago

jstmn commented 2 years ago

I'm unable to import klampts viz module on my laptop which is running Ubuntu 22.04

(venv) [ ~/Projects/nn_ik ] $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy

To replicate:

  1. Create a new virtual environment for the test: python3.8 -m venv venv_TEST; source venv_TEST/bin/activate
  2. Install klampt, PyOpenGL, PyQt5 in the virtual environment:
    pip install klampt
    pip install PyOpenGL PyQt5
  3. Try importing the viz module:
    (venv_TEST) [ ~/Projects/nn_ik ] $ python
    Python 3.8.13 (default, Apr 19 2022, 02:32:06) 
    [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from klampt import vis
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/klampt/vis/__init__.py", line 3, in <module>
    from .glprogram import *
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/klampt/vis/glprogram.py", line 11, in <module>
    from .glviewport import GLViewport
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/klampt/vis/glviewport.py", line 8, in <module>
    from . import gldraw
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/klampt/vis/gldraw.py", line 10, in <module>
    from OpenGL import GLUT
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/OpenGL/GLUT/__init__.py", line 5, in <module>
    from OpenGL.GLUT.fonts import *
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/OpenGL/GLUT/fonts.py", line 20, in <module>
    p = platform.getGLUTFontPointer( name )
    File "/home/jeremysmorgan/Projects/nn_ik/venv_TEST/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 350, in getGLUTFontPointer
    raise NotImplementedError( 
    NotImplementedError: Platform does not define a GLUT font retrieval function

    Anyone know how to resolve this issue? I searched around on google but couldn't find anything helpful.

Thanks

krishauser commented 2 years ago

Seems like GLUT is in the process of being deprecated for your system. Perhaps this workaround will help?

https://bytemeta.vip/repo/MPI-IS/mesh/issues/66

jstmn commented 2 years ago

That fixed it, thanks!

I somehow missed that post when I was searching online