sanderland / katrain

Improve your Baduk skills by training with KataGo!
Other
1.58k stars 224 forks source link

Upgrade Kivy and KivyMD versions #445

Open FlorianCcj opened 3 years ago

FlorianCcj commented 3 years ago

I have some problem launching katrain

I am on ubuntu 20 here version datas

➜  init_chromebook git:(master) ✗ python --version                                                   
Python 3.9.5                                                                                         
➜  init_chromebook git:(master) ✗ pip3 install -U katrain
Requirement already up-to-date: katrain in /usr/local/lib/python3.9/dist-packages (1.8.4)
Requirement already satisfied, skipping upgrade: kivy[full]>=2.0.0 in /usr/local/lib/python3.9/dist-packages (from katrain) (2.0.0)
Requirement already satisfied, skipping upgrade: urllib3 in /usr/lib/python3/dist-packages (from katrain) (1.25.8)
Requirement already satisfied, skipping upgrade: screeninfo; platform_system != "Darwin" in /usr/local/lib/python3.9/dist-packages (from katrain) (0.6.7)
Requirement already satisfied, skipping upgrade: kivymd>=0.104.1 in /usr/local/lib/python3.9/dist-packages (from katrain) (0.104.2)
Requirement already satisfied, skipping upgrade: chardet in /usr/lib/python3/dist-packages (from katrain) (3.0.4)
Requirement already satisfied, skipping upgrade: wheel in /usr/lib/python3/dist-packages (from katrain) (0.34.2)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python3/dist-packages (from katrain) (45.2.0)     
Requirement already satisfied, skipping upgrade: pygments in /usr/local/lib/python3.9/dist-packages (from kivy[full]>=2.0.0->katrain) (2.9.0)
Requirement already satisfied, skipping upgrade: docutils in /usr/local/lib/python3.9/dist-packages (from kivy[full]>=2.0.0->katrain) (0.17.1)
Requirement already satisfied, skipping upgrade: Kivy-Garden>=0.1.4 in /usr/local/lib/python3.9/dist-packages (from kivy[full]>=2.0.0->katrain) (0.1.4)
Requirement already satisfied, skipping upgrade: ffpyplayer; (sys_platform == "linux" or sys_platform == "darwin") and extra == "full" in /usr/local/lib/python3.9/dist-packages (from kivy[full]>=2.0.0->k
atrain) (4.3.2)
Requirement already satisfied, skipping upgrade: pillow; extra == "full" in /usr/local/lib/python3.9/dist-packages (from kivy[full]>=2.0.0->katrain) (8.2.0)
Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3/dist-packages (from Kivy-Garden>=0.1.4->kivy[full]>=2.0.0->katrain) (2.22.0)

When I launch katrain -d

➜  init_chromebook git:(master) ✗ katrain -d
[INFO   ] [Logger      ] Record log in /home/florianccj/.kivy/logs/kivy_21-06-27_19.txt
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "/usr/local/lib/python3.9/dist-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.5 (default, May 19 2021, 11:32:47) 
[GCC 9.3.0]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python"
[INFO   ] [Factory     ] 186 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.2
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[INFO   ] [Clipboard   ] Provider: xclip
[INFO   ] [CutBuffer   ] cut buffer support enabled
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'4.6.0 NVIDIA 465.27'>
[INFO   ] [GL          ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO   ] [GL          ] OpenGL renderer <b'NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60 NVIDIA'>
[INFO   ] [GL          ] Texture max size <32768>
[INFO   ] [GL          ] Texture max units <32>
[DEBUG  ] [Shader      ] Fragment compiled successfully
[DEBUG  ] [Shader      ] Vertex compiled successfully
[DEBUG  ] [ImageSDL2   ] Load </usr/local/lib/python3.9/dist-packages/kivy/data/glsl/default.png>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [KivyMD      ] 0.104.2, git-bc7d1f5, 2021-06-06 (installed at "/usr/local/lib/python3.9/dist-packages/kivymd/__init__.py")
[DEBUG  ] [Cache       ] register <textinput.label> with limit=None, timeout=60.0
[DEBUG  ] [Cache       ] register <textinput.width> with limit=None, timeout=60.0
 Traceback (most recent call last):
   File "/usr/local/bin/katrain", line 5, in <module>
     from katrain.__main__ import run_app
   File "/usr/local/lib/python3.9/dist-packages/katrain/__main__.py", line 68, in <module>
     from katrain.gui.popups import ConfigTeacherPopup, ConfigTimerPopup, I18NPopup, SaveSGFPopup, ContributePopup
   File "/usr/local/lib/python3.9/dist-packages/katrain/gui/popups.py", line 42, in <module>
     from katrain.gui.kivyutils import BackgroundMixin, I18NSpinner
   File "/usr/local/lib/python3.9/dist-packages/katrain/gui/kivyutils.py", line 78, in <module>
     class SizedButton(LeftButtonBehavior, RectangularRippleBehavior, BasePressedButton, BaseFlatButton, BackgroundMixin):
 TypeError: Cannot create a consistent method resolution
 order (MRO) for bases ButtonBehavior, RectangularRippleBehavior, BasePressedButton, BaseFlatButton, BackgroundMixin

I search to resolve it but the only "solution" was to install python 3.9 ...

sanderland commented 3 years ago

Could you link to the solution you found? You are saying this is a py 3.9.5 vs 3.9 issue? That seems very strange

FlorianCcj commented 3 years ago

it is very strange, I don't have any solution, that why I ask if you ve already seen this problem or if you have a solution ... it seems not ^^ It s not a 3.9 problem, I had python 3.8 and I see somewhere "update it will solve the problem" that why I test with 3.9

I will continue to search but ... it s strange

sanderland commented 3 years ago

what's your kivymd version? different from the one in requirements.txt? i suspect some change there broke it

FlorianCcj commented 3 years ago

I have juste made pip3 install katrain ^^

➜  git:(master) ✗ pip3 list | grep kivy 
kivymd                  0.104.2 
FlorianCcj commented 3 years ago

resolve with pip install -r requirements.txt, thanks a lot :)

sanderland commented 3 years ago

actually I see kivymd is breaking on a patch release, I've locked in 0.104.1, but should look into this

sanderland commented 1 year ago

Some work on this in this branch: https://github.com/sanderland/katrain/tree/kivybump But many small things changed, particularly how buttons are inherited, and some display differences in this remain.

freysgodi commented 1 year ago

manjaro linux. have kyvymd issue after system update

katrain 1.11.2 requires kivymd==0.104.1, but you have kivymd 1.1.1 which is incompatible.

i did downgrade kyvy to 0.104 version, but katrain still doesn't works

pip list | grep kivy kivymd 0.104.1

sdl2 - ImportError: libhwy.so.1: cannot open shared object file: No such file or directory

but i have not any libwhy module in my system, and there is no such module in repos. wondered a little bit

sanderland commented 1 year ago

manjaro linux. have kyvymd issue after system update

katrain 1.11.2 requires kivymd==0.104.1, but you have kivymd 1.1.1 which is incompatible.

i did downgrade kyvy to 0.104 version, but katrain still doesn't works

pip list | grep kivy kivymd 0.104.1

sdl2 - ImportError: libhwy.so.1: cannot open shared object file: No such file or directory

but i have not any libwhy module in my system, and there is no such module in repos. wondered a little bit

Have a look at the kivy installation instructions and the troubleshooting, they have some packages which may help. I've not seen this particular error before though

StHagel commented 1 year ago

Hey there, is this issue still being worked on? If yes, what kind of help would be appreciated?

unelsson commented 3 months ago

manjaro linux. have kyvymd issue after system update

katrain 1.11.2 requires kivymd==0.104.1, but you have kivymd 1.1.1 which is incompatible.

i did downgrade kyvy to 0.104 version, but katrain still doesn't works

Yeah, katrain freezes on Manjaro when playing a move. It doesn't matter whether it's AI playing the move or a human player playing. I'm trying to look at the issue, but I haven't looked at katrain code before, so all ideas are welcome.

edit: Last debug-message is (edit2: using 1.15.0 branch at commit 40e0ef3c85d1adbf76f95438f63c21f5ef3f7aea) [DEBUG ] [ImageSDL2 ] Load </home/nelsson/Koodi/katrain_git/katrain/katrain/img/topmove.png> Message Loop Received play: ((15, 15),) for Game 2024-05-20 17 12 41 Sending query QUERY:2: {"rules": "japanese", "priority": 1001, "analyzeTurns": [1], "maxVisits": 500, "komi": 6.5, "boardXSize": 19, "boardYSize": 19, "includeOwnership": true, "includeMovesOwnership": true, "includePolicy": true, "initialStones": [], "initialPlayer": "B", "moves": [["B", "Q16"]], "overrideSettings": {"reportAnalysisWinratesAs": "BLACK", "wideRootNoise": 0.04, "maxTime": 8.0}, "reportDuringSearchEvery": 1, "id": "QUERY:2"}

edit3: This smells like a threading problem, likely not related to kivymd though since it occurs also with kivymd 0.104.1

unelsson commented 3 months ago

Crash in Manjaro is caused by this row https://github.com/sanderland/katrain/blob/98ce47c3bc5f1c8c1a9cc03120e4afcd2cf677db/katrain/__main__.py#L435

So it's sound-related.

edit: This in particular crashes https://github.com/sanderland/katrain/blob/98ce47c3bc5f1c8c1a9cc03120e4afcd2cf677db/katrain/gui/sound.py#L26 . I don't see a problem in katrain codebase here, but rather something wrong with kivy.

unelsson commented 3 months ago

As for other information relating to Manjaro:

1) AUR package python-kivymd is for version 1.1.1, which doesn't seem to work with katrain. As a workaround, 0.104.1 can be used, but sounds will lock the program, so one needs to also hack katrain/katrain/gui/sound.py to prevent SoundLoader.load being called.

2) Using the latest kivymd version can be tried manually with:

git clone https://github.com/kivymd/KivyMD.git --depth 1 # git clone as in kivymd instructions
cd KivyMD
python3 -m venv kivyenv --system-site-packages # create virtual environment "kivyenv" with access to system-wide python packages
source kivyenv/bin/activate # get into kivyenv virtual environment
pip install . #install kivymd to virtual env

...but this only gets to as far as seeing where katrain is at kivymd update. Seems like there are at least some deprecated buttons that needs to be updated. ImportError: cannot import name 'BaseFlatButton' from 'kivymd.uix.button' ... Did you mean: 'BaseFabButton'?

unelsson commented 3 months ago

Here a crude PR https://github.com/sanderland/katrain/pull/684 that updates katrain to KivyMD 2.0.0 (using python-kivy 2.2.1-3, Manjaro linux repositories)

It's not supposed to be a proper solution, but it's a start.

unelsson commented 3 months ago

[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute. happens because of https://github.com/sanderland/katrain/blob/98ce47c3bc5f1c8c1a9cc03120e4afcd2cf677db/katrain/gui.kv#L683

I tested all rows containing size_hint.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days.