Amulet-Team / Amulet-Map-Editor

A new Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7.
https://www.amuletmc.com/
1.77k stars 123 forks source link

PIP Amulet Crashes on load #1108

Closed EvilSupahFly closed 3 weeks ago

EvilSupahFly commented 3 weeks ago

Bug Report

As part of my Flatpak troubleshooting, I have been creating and destroying VENVs for testing Amulet in. However, recently PIP Amulet had been crashing the second it starts running with an error reading "undefined symbol: _Py_NegativeRefcount."

Current Behaviour:

In the terminal, I type python3 -m amulet_map_editor and it instantly bombs with the above error.

Expected behavior:

.... I just want it to run.

Steps To Reproduce:

Install pythonz and install Python 3.12.6 into a VENV. Enter said VENV and install Amulet like so:

pip3 install --isolated --no-cache-dir amulet_map_editor

Then attempt to launch Amulet like so:

python3 -m amulet_map_editor

Environment:

Additional context

The Flatpak Python version is 3.12.6 - that's why I picked it for the VENV, however, for the purposes of this ticket, I tested this by creating various VENVs from Python 3.9, 3.10, 3.11 and 3.12, all with the same result.

Attachments

Terminal output:

evilsupahfly on Black-Beast at Sat 19 Oct 2024 23:05:10 EDT
[~/python-virtual-environs] pyvenv amulet-3126 3.12.6
The VENV "amulet-3126" doesn't exist. Creating it now.

    $usepy=/home/evilsupahfly/.pythonz/pythons/CPython-3.12.6/bin/python3
    $v_name=amulet-3126
    $v_home=/home/evilsupahfly/python-virtual-environs/amulet-3126
    $py_ver=3.12.6

Type 'deactivate' to exit this venv when you're done.

(amulet-3126) evilsupahfly on Black-Beast at Sat 19 Oct 2024 23:05:38 EDT
[~/python-virtual-environs] pip3 install --isolated --no-cache-dir amulet_map_editor
Collecting amulet_map_editor
  Downloading amulet_map_editor-0.10.36.tar.gz (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 12.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting Pillow>=10.0.1 (from amulet_map_editor)
  Downloading pillow-11.0.0-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (9.1 kB)
Collecting wxPython (from amulet_map_editor)
  Downloading wxPython-4.2.2.tar.gz (57.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.4/57.4 MB 14.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy~=1.17 (from amulet_map_editor)
  Downloading numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Collecting pyopengl~=3.0 (from amulet_map_editor)
  Downloading PyOpenGL-3.1.7-py3-none-any.whl.metadata (3.2 kB)
Collecting packaging (from amulet_map_editor)
  Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting amulet-core~=1.9 (from amulet_map_editor)
  Downloading amulet_core-1.9.25-py3-none-any.whl.metadata (4.3 kB)
Collecting amulet-nbt~=2.0 (from amulet_map_editor)
  Downloading amulet-nbt-2.1.3.tar.gz (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 14.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pymctranslate~=1.2 (from amulet_map_editor)
  Downloading PyMCTranslate-1.2.28-py3-none-any.whl.metadata (2.2 kB)
Collecting minecraft-resource-pack~=1.3 (from amulet_map_editor)
  Downloading minecraft_resource_pack-1.4.5-py3-none-any.whl.metadata (970 bytes)
Collecting platformdirs~=3.1 (from amulet_map_editor)
  Downloading platformdirs-3.11.0-py3-none-any.whl.metadata (11 kB)
Collecting portalocker~=2.4 (from amulet-core~=1.9->amulet_map_editor)
  Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
Collecting amulet-leveldb~=1.0b0 (from amulet-core~=1.9->amulet_map_editor)
  Downloading amulet_leveldb-1.0.2.tar.gz (745 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 745.5/745.5 kB 14.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting lz4~=4.3 (from amulet-core~=1.9->amulet_map_editor)
  Downloading lz4-4.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.7 kB)
Collecting mutf8~=1.0 (from amulet-nbt~=2.0->amulet_map_editor)
  Downloading mutf8-1.0.6.tar.gz (6.4 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting six (from wxPython->amulet_map_editor)
  Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Downloading amulet_core-1.9.25-py3-none-any.whl (273 kB)
Downloading minecraft_resource_pack-1.4.5-py3-none-any.whl (443 kB)
Downloading numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.0/18.0 MB 11.6 MB/s eta 0:00:00
Downloading pillow-11.0.0-cp312-cp312-manylinux_2_28_x86_64.whl (4.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 14.4 MB/s eta 0:00:00
Downloading platformdirs-3.11.0-py3-none-any.whl (17 kB)
Downloading PyMCTranslate-1.2.28-py3-none-any.whl (1.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 13.0 MB/s eta 0:00:00
Downloading PyOpenGL-3.1.7-py3-none-any.whl (2.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 14.8 MB/s eta 0:00:00
Downloading packaging-24.1-py3-none-any.whl (53 kB)
Downloading lz4-4.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 14.9 MB/s eta 0:00:00
Downloading portalocker-2.10.1-py3-none-any.whl (18 kB)
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: amulet_map_editor, amulet-nbt, wxPython, amulet-leveldb, mutf8
  Building wheel for amulet_map_editor (pyproject.toml) ... done
  Created wheel for amulet_map_editor: filename=amulet_map_editor-0.10.36-cp312-cp312-linux_x86_64.whl size=2640965 sha256=7b4debb7ee74b1c4913f8132a6f608a7768187a00b77d79ba2d082a69317a239
  Stored in directory: /tmp/pip-ephem-wheel-cache-1r4_u8y7/wheels/cd/89/dd/f80797370f3a21fed42588ee28d09a5e55e9e9ed32d39c155d
  Building wheel for amulet-nbt (pyproject.toml) ... done
  Created wheel for amulet-nbt: filename=amulet_nbt-2.1.3-cp312-cp312-linux_x86_64.whl size=4943629 sha256=6d8c360de56a011ce9044ba4c73c25b5e62abb8e1e96ffd60302e8364c9e6ada
  Stored in directory: /tmp/pip-ephem-wheel-cache-1r4_u8y7/wheels/c5/67/29/928c2614cd751ae16800431c80521910c9fac19c52eb357db8
  Building wheel for wxPython (pyproject.toml) ... done
  Created wheel for wxPython: filename=wxPython-4.2.2-cp312-cp312-linux_x86_64.whl size=110354518 sha256=10e48606aa0265bb67bf27c0d15a9a161b6a33efe3383c085f395b1176fe91b1
  Stored in directory: /tmp/pip-ephem-wheel-cache-1r4_u8y7/wheels/dd/a1/8b/26ce0cf99752ee0fb0492af81af5a3205cb9c66358e70f4882
  Building wheel for amulet-leveldb (pyproject.toml) ... done
  Created wheel for amulet-leveldb: filename=amulet_leveldb-1.0.2-cp312-cp312-linux_x86_64.whl size=2589068 sha256=43416c1409fbdaaa2a703af968eb0c571cc92544ee1ac959f866c175317b1150
  Stored in directory: /tmp/pip-ephem-wheel-cache-1r4_u8y7/wheels/2c/08/6b/1bcd04829ec2b567763f34a95234e2e57295e6c34631ff0cc5
  Building wheel for mutf8 (pyproject.toml) ... done
  Created wheel for mutf8: filename=mutf8-1.0.6-cp312-cp312-linux_x86_64.whl size=20057 sha256=bc5375116c14df7c3f639421eb65fa9d6e97bf449d8944d066e0b26781733841
  Stored in directory: /tmp/pip-ephem-wheel-cache-1r4_u8y7/wheels/c2/2a/80/4c1ef20c67de151e7de0f1d4168f9a7e26c75d54403c6114a8
Successfully built amulet_map_editor amulet-nbt wxPython amulet-leveldb mutf8
Installing collected packages: pyopengl, mutf8, six, portalocker, platformdirs, Pillow, packaging, numpy, lz4, amulet-leveldb, wxPython, amulet-nbt, pymctranslate, minecraft-resource-pack, amulet-core, amulet_map_editor
Successfully installed Pillow-11.0.0 amulet-core-1.9.25 amulet-leveldb-1.0.2 amulet-nbt-2.1.3 amulet_map_editor-0.10.36 lz4-4.3.3 minecraft-resource-pack-1.4.5 mutf8-1.0.6 numpy-1.26.4 packaging-24.1 platformdirs-3.11.0 portalocker-2.10.1 pymctranslate-1.2.28 pyopengl-3.1.7 six-1.16.0 wxPython-4.2.2

(amulet-3126) evilsupahfly on Black-Beast at Sat 19 Oct 2024 23:29:09 EDT
[~/python-virtual-environs] python3 -m amulet_map_editor
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/amulet_map_editor/__init__.py", line 27, in <module>
    from amulet_map_editor.api.framework.app import open_level, close_level
  File "/home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/amulet_map_editor/api/framework/__init__.py", line 1, in <module>
    from .app import AmuletApp
  File "/home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/amulet_map_editor/api/framework/app.py", line 1, in <module>
    import wx
  File "/home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /home/evilsupahfly/python-virtual-environs/amulet-3126/lib/python3.12/site-packages/wx/_core.cpython-312-x86_64-linux-gnu.so: undefined symbol: _Py_NegativeRefcount

(amulet-3126) evilsupahfly on Black-Beast at Sat 19 Oct 2024 23:34:09 EDT
[~/python-virtual-environs] 

Even if I nuke the VENV and start over, I get the exact same result, every time.

gentlegiantJGC commented 3 weeks ago

Related to your previous issue in #1093

gentlegiantJGC commented 3 weeks ago

From my previous evalulation it is probably because python and wxpython were compiled with different compiler flags that expose different symbols.

EvilSupahFly commented 3 weeks ago

Damn. I wondered why this error seemed so familiar. But creating a clean new virtual Python environment for a specific version, then grabbing Amulet with PIP in that version was the fix last time, according to the ticket. This time it's not working, which was why I specified pip3 install --isolated --no-cache-dir amulet_map_editor. I wanted to be doubly sure there was no outside influence. So the problem is my Python environment, I guess, despite running in virtual.

EvilSupahFly commented 3 weeks ago

Since this is a repeat of #1093, which was resolved, I'll just close this and go try to sort out my Python situation, and figure out why it's not behaving this time.