Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError Unable to load OpenGL library in macOS Monterey #72

Open
web3dkorea opened this issue Jan 10, 2022 · 2 comments
Open

ImportError Unable to load OpenGL library in macOS Monterey #72

web3dkorea opened this issue Jan 10, 2022 · 2 comments

Comments

@web3dkorea
Copy link

  • Python : 3.8.3
  • PyOpenGL : 3.1.5
  • PyOpenGL-accelerate : 3.1.5

Error Log

Traceback (most recent call last):
    from OpenGL.GL import *
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/GL/__init__.py", line 3, in <module>
    from OpenGL import error as _error
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/error.py", line 12, in <module>
    from OpenGL import platform, _configflags
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/__init__.py", line 36, in <module>
    _load()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/__init__.py", line 33, in _load
    plugin.install(globals())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 97, in install
    namespace[ name ] = getattr(self,name,None)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 62, in GetCurrentContext
    return self.CGL.CGLGetCurrentContext
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 45, in CGL
    def CGL(self): return self.GL
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 41, in GL
    raise ImportError("Unable to load OpenGL library", *err.args)
ImportError: ('Unable to load OpenGL library', "dlopen(OpenGL, 0x000A): tried: 'OpenGL' (no such file), '/usr/lib/OpenGL' (no such file), '/Users/has3ong/Desktop/GITHUB/X3D_LB_Python/OpenGL' (no such file), '/usr/lib/OpenGL' (no such file)", 'OpenGL', None)

I solved it in the same way in this issues

macOS Big Sur, could not load OpenGL library #61

vi /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/OpenGL/platform/ctypesloader.py
def _loadLibraryWindows(dllType, name, mode):
    """Load a given library for Windows systems

    returns the ctypes C-module object
    """
    fullName = None
    try:
        fullName = util.find_library( name )

        # Insert this codes
        fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'
        #

        if fullName is not None:
            name = fullName
        elif os.path.isfile( os.path.join( DLL_DIRECTORY, name + '.dll' )):
            name = os.path.join( DLL_DIRECTORY, name + '.dll' )
    except Exception as err:
        _log.info( '''Failed on util.find_library( %r ): %s''', name, err )
        # Should the call fail, we just try to load the base filename...
        pass
    try:
        return dllType( name, mode )
    except Exception as err:
        err.args += (name,fullName)
        raise

However, there are still font related issues.

Unable to load font: GLUT_STROKE_ROMAN
Unable to load font: GLUT_STROKE_MONO_ROMAN
Unable to load font: GLUT_BITMAP_9_BY_15
Unable to load font: GLUT_BITMAP_8_BY_13
Unable to load font: GLUT_BITMAP_TIMES_ROMAN_10
Unable to load font: GLUT_BITMAP_TIMES_ROMAN_24
Unable to load font: GLUT_BITMAP_HELVETICA_10
Unable to load font: GLUT_BITMAP_HELVETICA_12
Unable to load font: GLUT_BITMAP_HELVETICA_18

Is there no way?

@MrBenGriffin
Copy link

This is all fixed in Python3.10

@jmroot
Copy link

jmroot commented May 14, 2022

Specifically it was fixed in Python 3.9.1 and 3.8.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants