From f2c9d56a1fe5c400ccfcd03f6e47a5589c7b3cb2 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Fri, 27 Apr 2018 13:58:24 +0100 Subject: [PATCH] Load libGL using low-level function without requiring pyopengl Loading libGL at the very start fixes a segmentation fault on some Linux systems. This uses a low-level function from cdll to load libGL instead of requiring and importing pyopengl which implicitly loads libGL )I guess). Thus, we also drop the pyopengl requirement. --- setup.py | 5 +---- spyder/app/start.py | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index a53e906d0cc..e95b8ee93ee 100644 --- a/setup.py +++ b/setup.py @@ -291,10 +291,7 @@ def run(self): 'numpydoc', # Packages for pyqt5 are only available in # Python 3 - 'pyqt5<5.10;python_version>="3"', - # This is only needed for our wheels on Linux. - # See issue #3332 - 'pyopengl;platform_system=="Linux"' + 'pyqt5<5.10;python_version>="3"' ] extras_require = { diff --git a/spyder/app/start.py b/spyder/app/start.py index ef3c88c05bc..bde5380354a 100644 --- a/spyder/app/start.py +++ b/spyder/app/start.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Std imports +import ctypes import os import os.path as osp import random @@ -12,10 +13,10 @@ # See issue 5324 import zmq -# This import is needed to fix errors with OpenGL when installed using pip -# See issue 3332 +# Load GL library to prevent segmentation faults on some Linux systems +# See issues 3226 and 3332 try: - from OpenGL import GL + ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL) except: pass