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

import numpy >=1.26.4, raise error #1357

Open
djy89 opened this issue Jul 21, 2024 · 3 comments
Open

import numpy >=1.26.4, raise error #1357

djy89 opened this issue Jul 21, 2024 · 3 comments

Comments

@djy89
Copy link

djy89 commented Jul 21, 2024

when i add import numpy as np at file.py and run debug
why raise this.....
File "....python3.12/site-packages/OCC/Display/qtDisplay.py", line 104, in InitDriver
self._display.Create(window_handle=int(self.winId()), parent=self)
File ".../python3.12/site-packages/OCC/Display/OCCViewer.py", line 212, in Create
self.Init(self._window_handle)
File ".../python3.12/site-packages/OCC/Core/Visualization.py", line 185, in Init
return _Visualization.Display3d_Init(self, handle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Aspect_GraphicDeviceDefinitionErrorOpenGl_Window::CreateWindow: glXCreateContext failed. raised from method Init of class Display3d

@tpaviot
Copy link
Owner

tpaviot commented Jul 22, 2024

please attach the related file

@djy89
Copy link
Author

djy89 commented Jul 22, 2024

Thank you for your attention. For all the imported packages in this file, no matter how they are coordinated, importing numpy will report errors related to OpenGL. In addition, when I use load_mackend ("pyqt6"), these errors will also be reported. How can I determine if I will only use pyqt6 and importing numpy without errors, or if I will only use pyside6 and importing numpy without errors

@djy89
Copy link
Author

djy89 commented Jul 22, 2024

from __future__ import print_function
import sys
from OCC.Display.backend import load_any_qt_backend, get_qt_modules
load_any_qt_backend()
from OCC.Display.backend import load_backend
load_backend("pyside6")
from PyQt6 import QtWidgets, QtGui, QtCore, QtWidgets, QtOpenGL
# from PySide6 import QtWidgets, QtGui, QtCore, QtWidgets, QtOpenGL
# QtCore, QtGui, QtWidgets, QtOpenGL = get_qt_modules()
from OCC.Display.qtDisplay import qtViewer3d
# import numpy  as np

class GLWidget(qtViewer3d):
    def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)
if __name__ == '__main__':
    def TestOverPainting():
        class AppFrame(QtWidgets.QWidget):
            def __init__(self, parent=None):
                QtWidgets.QWidget.__init__(self, parent)
                self.setWindowTitle(self.tr("qtDisplay3d overpainting example"))
                self.resize(1280, 1024)
                self.canva = GLWidget(self)
                mainLayout = QtWidgets.QHBoxLayout()
                mainLayout.addWidget(self.canva)
                mainLayout.setContentsMargins(0, 0, 0, 0)
                self.setLayout(mainLayout)

            def runTests(self):
                self.canva._display.Test()

        app = QtWidgets.QApplication(sys.argv)
        frame = AppFrame()
        frame.show()
        frame.runTests()
        app.exec()

    TestOverPainting()

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

No branches or pull requests

2 participants