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

Amulet won't instal (Arch/Pyth3.9) #281

Closed
Akan9021 opened this issue May 3, 2021 · 24 comments
Closed

Amulet won't instal (Arch/Pyth3.9) #281

Akan9021 opened this issue May 3, 2021 · 24 comments

Comments

@Akan9021
Copy link

Akan9021 commented May 3, 2021

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

Describe the bug
When I try running the installer from source via "python -m pip install amulet-map-editor --upgrade". It doesn't work out.

  Using cached amulet_map_editor-0.8.4-py3-none-any.whl (1.7 MB)
Collecting amulet-core~=1.2.4
  Using cached amulet_core-1.2.5-py3-none-any.whl (975 kB)
Collecting pymctranslate~=1.0.0
  Using cached PyMCTranslate-1.0.2-py3-none-any.whl (530 kB)
Collecting minecraft-resource-pack~=1.2.0
  Using cached minecraft_resource_pack-1.2.1-py3-none-any.whl (430 kB)
Collecting amulet-nbt~=1.0.3
  Using cached amulet_nbt-1.0.3.8-cp39-cp39-linux_x86_64.whl
Collecting pyopengl
  Using cached PyOpenGL-3.1.5-py3-none-any.whl (2.4 MB)
Collecting numpy
  Using cached numpy-1.20.2-cp39-cp39-manylinux2010_x86_64.whl (15.4 MB)
Collecting cython>=0.29.13
  Using cached Cython-0.29.23-cp39-cp39-manylinux1_x86_64.whl (1.9 MB)
Collecting Pillow>=7.1.0
  Downloading Pillow-8.2.0-cp39-cp39-manylinux1_x86_64.whl (3.0 MB)
     |████████████████████████████████| 3.0 MB 2.6 MB/s 
Installing collected packages: numpy, cython, amulet-nbt, pymctranslate, Pillow, pyopengl, minecraft-resource-pack, amulet-core, amulet-map-editor
Successfully installed Pillow-8.2.0 amulet-core-1.2.5 amulet-map-editor-0.8.4 amulet-nbt-1.0.3.8 cython-0.29.23 minecraft-resource-pack-1.2.1 numpy-1.20.2 pymctranslate-1.0.2 pyopengl-3.1.5

I followed the guided instructions but when I use python amulet_map_editor, it errors out saying it can't find the directory, even when i use Python3, I tested these in a virtual enviroment and it didn't work, First attempts errored out with wheel but even installing that first didn't change anything, i just get
python3: can't open file '/home/user/amulet_map_editor': [Errno 2] No such file or directory

To Reproduce
Steps to reproduce the behavior:

  1. Run python3 -m pip install amulet-map-editor --upgrade
  2. Run python3 amulet_map_editor afterward

Expected behavior
The program opens up

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Manjaro Linux
  • Version: 5.10.32

Additional context
Add any other context about the problem here.

@jimbt
Copy link

jimbt commented May 3, 2021

The launch command should be 'python3 -m amulet_map_editor'. The key is the '-m' option.

I also used 'python3' because you need to ensure python 3.x is used instead of 2.x, but it might not be necessary.

@Akan9021
Copy link
Author

Akan9021 commented May 4, 2021

The launch command should be 'python3 -m amulet_map_editor'. The key is the '-m' option.

I also used 'python3' because you need to ensure python 3.x is used instead of 2.x, but it might not be necessary.

That did make some progress, but now when I do that it just does this

    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/user/.local/lib/python3.9/site-packages/amulet_map_editor/__main__.py", line 9, in <module>
    from amulet_map_editor.api.framework import AmuletApp
  File "/home/user/.local/lib/python3.9/site-packages/amulet_map_editor/api/framework/__init__.py", line 1, in <module>
    from .amulet_ui import AmuletUI
  File "/home/user/.local/lib/python3.9/site-packages/amulet_map_editor/api/framework/amulet_ui.py", line 1, in <module>
    import wx
ModuleNotFoundError: No module named 'wx'

@jimbt
Copy link

jimbt commented May 4, 2021

Did you create a (venv) virtual environment? What is listed when you run 'pip list' ?

@Akan9021
Copy link
Author

Akan9021 commented May 4, 2021

Did you create a (venv) virtual environment? What is listed when you run 'pip list' ?

amulet-map-editor       0.8.4
amulet-nbt              1.0.3.8
Cython                  0.29.23
minecraft-resource-pack 1.2.1
numpy                   1.20.2
Pillow                  8.2.0
pip                     21.1.1
PyMCTranslate           1.0.2
PyOpenGL                3.1.5
setuptools              49.2.1

That's what I get when i run that, that's in a virtual environment as well

@jimbt
Copy link

jimbt commented May 4, 2021

It appears too me that you're missing a few dependencies. For example, I'd expect to see amulet-core and wxPython. amulet-core should have been included automatically (and easily). wxPython can be a pain since seems to often require manual building.

Try rerunning the install: 'pip install --upgrade amulet-map-editor' and see if you get any interesting warnings or errors. I would expect amulet-core to install at least unless an error is blocking it.

If wxPython doesn't get installed as a dependency you can manually install it with pip. I'd recommend version 4.1.0, but I don't know what is causing the problem (on my install) with the latest version 4.1.1 so it might work fine with python 3.9 (I have 3.7). Anyway be prepared to try both and if wxPython has to be built there may be other system tools and libraries to install. This page (https://www.wxpython.org/pages/downloads/) will provide details to possibly use a prebuilt wxPython wheel which should avoid build dependencies if it works for your system.

@gentlegiantJGC
Copy link
Member

I have just updated the install instructions on the website.
The log at the top says that core was installed so I don't know why it wouldn't be in the list later unless you uninstalled it.

@Akan9021
Copy link
Author

Akan9021 commented May 4, 2021

That's what I get when I run pip install --upgrade amulet-map-editor' in the virtual enviroment, i see amulet core so it looks like it's in there.
I'm on Manjaro so finding wxpython for Arch is kinda rough since they don't have that there, I did try it with a toolset from the package manager but all I get was this

I'll see if building from source will work, this system isn't good at compiling, overheated the first attempt at trying this, but I can try giving that a shot.

Virtual Enviroment

Requirement already satisfied: minecraft-resource-pack~=1.2.0 in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (1.2.1)
Requirement already satisfied: pyopengl in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (3.1.5)
Requirement already satisfied: amulet-nbt~=1.0.3 in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (1.0.3.8)
Requirement already satisfied: pymctranslate~=1.0.0 in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (1.0.2)
Requirement already satisfied: amulet-core~=1.2.4 in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (1.2.5)
Requirement already satisfied: numpy in ./tutorial-env/lib/python3.9/site-packages (from amulet-map-editor) (1.20.2)
Requirement already satisfied: cython>=0.29.13 in ./tutorial-env/lib/python3.9/site-packages (from amulet-nbt~=1.0.3->amulet-map-editor) (0.29.23)
Requirement already satisfied: Pillow>=7.1.0 in ./tutorial-env/lib/python3.9/site-packages (from minecraft-resource-pack~=1.2.0->amulet-map-editor) (8.2.0)```




Main System.


``` File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/chao/.local/lib/python3.9/site-packages/amulet_map_editor/__main__.py", line 9, in <module>
    from amulet_map_editor.api.framework import AmuletApp
  File "/home/chao/.local/lib/python3.9/site-packages/amulet_map_editor/api/framework/__init__.py", line 1, in <module>
    from .amulet_ui import AmuletUI
  File "/home/chao/.local/lib/python3.9/site-packages/amulet_map_editor/api/framework/amulet_ui.py", line 31, in <module>
    wx.Image.SetDefaultLoadFlags(0)
AttributeError: type object 'Image' has no attribute 'SetDefaultLoadFlags'```

@gentlegiantJGC
Copy link
Member

The issue with wheel needing manually installing for the nbt library should be fixed in the release I am about to put out

@IoIxD
Copy link

IoIxD commented May 8, 2021

I'm actually not sure the Linux version is ever gonna be good. Having to use a virtual environment is wonky as shit and now it's not even working on Linux (I even tried straight up git cloning the resository and this "SetDefaultLoadFlags" error still doesn't seem to be fixed). The Windows version should hypothetically run with wine if one can get wxWidgets working on wine, but in the meanwhile I'm just gonna boot into Windows and use that version...

@gentlegiantJGC
Copy link
Member

Looking through the documentation SetDefaultLoadFlags was added in WxPython 4.1 so it is possible you both have an old version of wxpython if it does not have that attribute.

Python virtual environments are fairly normal. It makes it possible to have different versions of a library installed that are required by different programs. Without it you would need to install the correct version each time you want to switch between programs.

@gentlegiantJGC
Copy link
Member

There are some deeper issues on linux related to the opengl canvas and the ui overlayed on top which I am not sure how to solve.

I need to do some tests with Qt to see if it has the same issues but if it doesn't I plan to switch.

For now if you have access to Windows I would suggest using that.

@jimbt
Copy link

jimbt commented May 11, 2021

I'm not sure if I'm the other half of "you both", but I believe the OP and I both do use a virtual environment for our Amulet installs. wxPython 4.1.1 causes #247 for me while 4.1.0 works fine. I would guess the difference in errors is the result of the version of Python (i.e. I run 3.7 and OP runs 3.9).

@Akan9021, please try wxPython 4.1.0 if you can. It will probably require some build dependencies and take about 5 minutes to complete.

@jimbt
Copy link

jimbt commented May 25, 2021

Here's the resolution for the wxPython 4.1.1 issue - #247 (comment):

export PYOPENGL_PLATFORM=egl

Please try again and let's us know what you get.

BTW, virtual environments are a necessity with anything but the simplest of Python installations. Without them you will quickly run into the Python incarnation of "DLL Hell". They are a bit odd, but a simple application launch script can hide that awkwardness.

@IoIxD
Copy link

IoIxD commented Jun 5, 2021

Well, I tried it again, and it just...worked. I got the same errors as I did before, but at some point I downloaded the source and ran sudo python3 setup.py install, which I think installed the correct dependencies (a prebuilt wxPython whl being one of those, I believe), and now it just works.

@IoIxD
Copy link

IoIxD commented Jun 5, 2021

And now I can definitely confirm that it sucks on Linux. The UI flickers constantly, and it turns out this has been an open issue since November - #127 - and very little if anything has been done about it. It is barely usable, if it all, and the fact this was opened in November goes to show me that, sadly, not a single dev here actually uses Linux, which is unfortunate. So for now, I would not even bother. I am just biting the bullet and continuing to use the Windows version, because the Linux version is horrible anyways

If you are insane enough to use the Linux release, download 0.8.6 because for some reason - at least on my end - on 0.8.5 the 3d viewer straight up didn't even appear.

@gentlegiantJGC
Copy link
Member

I am not sure if the flickering is solvable with the current UI library. I spent a week trying to solve it on Mac before giving up.
I plan to switch to a different UI library which I think will allow us to fix the issue

@uiytt
Copy link

uiytt commented Jun 22, 2021

I had the same problem, just typing : pip install wxPython in my env solved it.
It's really weird that it is not installing it from requirement.txt

EDIT :
I don't know why, but @gentlegiantJGC put : wxPython ; sys_platform != 'linux' in requirement.txt
which I assume prevent wxPython from being installed on linux
I don't understand why it was done, but it's causing problem since wxPython is needed on linux

@gentlegiantJGC
Copy link
Member

I thought there wasn't a Linux build of wxpython on pip and even if there is I don't think it will work on all flavours of Linux.
Linux users have to manually install it so that installing the rest doesn't error on those flavours that the pip version does not work on

@uiytt
Copy link

uiytt commented Jun 22, 2021

I personally think that having a support for debian or at least ubuntu since it's the most used platform on Linux, instead of having no support at all.
removing sys_platform != 'linux' and telling somewhere in the setup instruction that Arch and other linux platform need to setup their own wxPython version. And this will prevent people from having to look into the issues etc..
(There is even a chance that the wxPython actually works for (almost) all Linux platform)

@gentlegiantJGC
Copy link
Member

If you removed that line all flavours would try installing the pip version. Some flavours would error while installing making it not possible to install Amulet at all.
Info about wxpython and linux can be found here
https://wxpython.org/pages/downloads/index.html

@Podshot
Copy link
Member

Podshot commented Jun 22, 2021

If you removed that line all flavours would try installing the pip version. Some flavours would error while installing making it not possible to install Amulet at all.

Info about wxpython and linux can be found here

https://wxpython.org/pages/downloads/index.html

We could possibly make a Linux script that when ran, would generate a requirements-generated.txt for that specific OS and would notify the user if they would need to install wxPython separately or if not, include it in the requirements-generated.txt

Then we would just modify the Linux install instructions to have the user run that script before continuing the install process

@uiytt
Copy link

uiytt commented Jun 22, 2021

If you removed that line all flavours would try installing the pip version. Some flavours would error while installing making it not possible to install Amulet at all.
Info about wxpython and linux can be found here
https://wxpython.org/pages/downloads/index.html

We could possibly make a Linux script that when ran, would generate a requirements-generated.txt for that specific OS and would notify the user if they would need to install wxPython separately or if not, include it in the requirements-generated.txt

Then we would just modify the Linux install instructions to have the user run that script before continuing the install process

This could work.
But currently, at least adding an instruction on the README.md telling Linux user that they need to install wxPython themselves might be enough

@gentlegiantJGC
Copy link
Member

I had a look into moving it into the setup.py but from what I remember they removed the ability to tell flavours apart at some point so I couldn't work out how to do it

@gentlegiantJGC
Copy link
Member

I am not sure what this bug ticket was even for originally. It mostly just looks like trying to help one user install it on linux.
Either way this is deviating quite a bit from the original bug.
Feel free to open a new feature request for better linux install instructions. You can add a pull request with the changes if you like.
I am going to close this issue

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

6 participants