Amulet-Map-Editor icon indicating copy to clipboard operation
Amulet-Map-Editor copied to clipboard

GLAttributes returned a result with an error set

Open Peng1029 opened this issue 3 years ago • 9 comments

Has this bug already been reported? Please check if there is a bug report already open that matches this.

Describe the bug A clear and concise description of what the bug is.

After clicking 3d editor I get

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/api/framework/pages/world_page.py", line 155, in _enable_active
self._extensions[self.GetSelection()].enable()
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/edit.py", line 50, in enable
self._canvas = EditCanvas(self, self._world, self._close_self_callback)
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/edit_canvas.py", line 92, in init
super().init(parent, world)
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/base_edit_canvas.py", line 58, in init
super().init(parent)
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/event_canvas.py", line 12, in init
super().init(parent)
File "/home/peng/.local/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/canvas.py", line 23, in init
display_attributes = wx.glcanvas.GLAttributes()
SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an error set
`

and then get locked out of the 3d editor

To Reproduce Steps to reproduce the behavior:

  1. Just follow the install for linux from scratch in a python env
  2. Load a minecraft bedrock world
  3. Click on 3d editor
  4. See error

Expected behavior A clear and concise description of what you expected to happen. The 3d editor starts Screenshots The error message showed both in the console & in a popup on screen

Desktop (please complete the following information): image

Additional context Add any other context about the problem here. Could be from the amount of corrupted files on my failing harddrive messing with python or something

Peng1029 avatar Oct 27 '21 14:10 Peng1029

I'm getting this exact behaviour too on Arch with Gnome under both X and Wayland, with a fresh python virtual environment. No idea how to pry further into wxPython's behaviour though!

quaderror avatar Oct 28 '21 14:10 quaderror

I resolved this issue for my particular setup by installing the Arch community/python-wxpython package.

I got a list of packages installed outside the virtual environment from a different machine with a working instance of Amulet on a hunch that pip was missing something wxpython required. I compared the package list on the working machine to the package list on the machine experiencing this error; a bunch of them were missing (working machine has a lot of cruft) and the python-wxpython was among them.

I'm assuming having installed wxpython using the package manager provided something opengl-related that pip missed, but I've no idea how to investigate it further.

quaderror avatar Nov 08 '21 13:11 quaderror

I'm getting an "Exception loading sub-program" dialog containing the same error (i.e. "NotImplementedError" and the trace). I recently upgraded to Debian 11 and built a new venv with python 3.9 (was 3.7 on Debian 10). Everything, including wxPython, seemed to go smoothly until this error opening the 3D editor.

$ pip list

Package Version ----------------------- -------- amulet-core 1.4.8 amulet-map-editor 0.8.15 amulet-nbt 1.0.3.10 minecraft-resource-pack 1.2.4 numpy 1.21.4 Pillow 8.4.0 pip 21.3.1 pkg_resources 0.0.0 PyMCTranslate 1.0.10 PyOpenGL 3.1.5 setuptools 58.5.3 six 1.16.0 wxPython 4.1.1

jimbt avatar Nov 14 '21 07:11 jimbt

Please open a new bug report. Your issue is different to this one

gentlegiantJGC avatar Nov 14 '21 07:11 gentlegiantJGC

This is still an issue and only effects some users on linux. There may be more information in #465 related to this issue.

gentlegiantJGC avatar Sep 05 '22 14:09 gentlegiantJGC

the error message has now changed in Amulet 0.10.8

`<class 'wx._glcanvas.GLAttributes'> returned a result with an error set NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/api/framework/pages/world_page.py", line 178, in _enable_page self.GetPage(page).enable() File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/edit.py", line 70, in enable self._canvas = EditCanvas(self, self._world) File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/edit_canvas.py", line 150, in init super().init(parent, world) File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/base_edit_canvas.py", line 62, in init super().init(parent) File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/event_canvas.py", line 15, in init super().init(parent) File "/usr/local/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/canvas.py", line 41, in init display_attributes = glcanvas.GLAttributes() SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an error set `

Max-RM avatar Jan 14 '23 10:01 Max-RM

After following a bit of the instructions at https://wxpython.org/pages/downloads/ and using this command pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython==4.1.1 --force-reinstall, I got the editor to work! Albeit in the state found at #127. The reason why I used ubuntu-18.04 is because it had the needed version 4.1.1 and it was for python 3.9 too.

For some reason the version that pip installs is wrong(?)

Flonja avatar Apr 03 '23 15:04 Flonja

It seems I found a solution. WXPython uses CPython to compile some classes. If it does not find some dependencies it just skips the compilation of related class (this is only MY THEORY). So, before installing WXPython you need to install some OpenGL dependencies. Commands (Ubuntu):

  1. pip install wxPython
  2. sudo apt-get install freeglut3-dev
  3. pip install wxPython --no-cache-dir

You might also check for other missing OpenGL dependencies for wxPython Source: https://stackoverflow.com/questions/62924897/failed-to-compile-wxwidget-3-0-5-opengl-libraries-not-available

wwwwwert avatar Oct 15 '23 13:10 wwwwwert

It seems I found a solution. WXPython uses CPython to compile some classes. If it does not find some dependencies it just skips the compilation of related class (this is only MY THEORY). So, before installing WXPython you need to install some OpenGL dependencies. Commands (Ubuntu):

  1. pip install wxPython
  2. sudo apt-get install freeglut3-dev
  3. pip install wxPython --no-cache-dir

You might also check for other missing OpenGL dependencies for wxPython Source: https://stackoverflow.com/questions/62924897/failed-to-compile-wxwidget-3-0-5-opengl-libraries-not-available

Yep, it works! Ty very much. image

Fixed typo in the first command:

  1. pip3 uninstall wxPython
  2. sudo apt-get install freeglut3-dev
  3. pip3 install wxPython --no-cache-dir

Note: the options are flickering like crazy! (https://github.com/Amulet-Team/Amulet-Map-Editor/issues/127) But I managed to open, edit and save multiple maps at the same time.

Xalalau avatar Mar 10 '24 01:03 Xalalau