karayaman / Play-online-chess-with-real-chess-board

Program that enables you to play online chess using real chess boards.
GNU General Public License v3.0
331 stars 25 forks source link

Game doesn't start #19

Closed erwin4u-alt closed 1 year ago

erwin4u-alt commented 1 year ago

Hello, I've installed the code on an Raspi Zero with Bullseye and it looks good so far. I'm able to scan the board, but if I try to start the game, I got an error (see below) Do you know, how to solve this issue? I run python (3.9.2) with sudo in an virtual environment - all libraries are installed...

Traceback (most recent call last): File "/home/pi/Play-online-chess-with-real-chess-board-1.15/main.py", line 10, in from board_basics import Board_basics File "/home/pi/Play-online-chess-with-real-chess-board-1.15/board_basics.py", line 3, in from skimage.metrics import structural_similarity File "/usr/local/lib/python3.9/dist-packages/skimage/init.py", line 151, in from ._shared import geometry File "skimage/_shared/geometry.pyx", line 1, in init skimage._shared.geometry ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject Game finished.

karayaman commented 1 year ago

Hi, it seems like there is an incompatibility between versions of numpy and scikit-image you are using. You can try reinstalling numpy with pip install --upgrade numpy or you can try downgrading scikit-image library to a previous version with pip uninstall scikit-image pip install scikit-image==0.19.3

erwin4u-alt commented 1 year ago

Hello - thank you for your quick response. Yes - until know I've updated numpy and afterwards I had to install libespeak-dev too. Now I'm able to connect to lichess. On lichess I can see, that I've used the API, but I getting an error in the GUI - someting is still wrong ->

Traceback (most recent call last): File "/home/pi/Play-online-chess-with-real-chess-board-1.15/main.py", line 81, in game = Game(board_basics, speech_thread, use_template, make_opponent, start_delay, comment_me, comment_opponent, File "/home/pi/Play-online-chess-with-real-chess-board-1.15/game.py", line 20, in init self.internet_game = Lichess_game(token) File "/home/pi/Play-online-chess-with-real-chess-board-1.15/lichess_game.py", line 12, in init games = client.games.get_ongoing() File "/usr/local/lib/python3.9/dist-packages/berserk/clients.py", line 476, in get_ongoing return self._r.get(path, params=params)['nowPlaying'] File "/usr/local/lib/python3.9/dist-packages/berserk/session.py", line 60, in get return self.request('GET', *args, kwargs) File "/usr/local/lib/python3.9/dist-packages/berserk/session.py", line 56, in request return fmt.handle(response, is_stream=is_stream, converter=converter) File "/usr/local/lib/python3.9/dist-packages/berserk/formats.py", line 35, in handle return converter(self.parse(response)) File "/usr/local/lib/python3.9/dist-packages/berserk/formats.py", line 76, in parse return response.json(cls=self.decoder) File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/usr/lib/python3/dist-packages/simplejson/init.py", line 542, in loads return cls(encoding=encoding, **kw).decode(s) TypeError: init() got an unexpected keyword argument 'encoding'

karayaman commented 1 year ago

It seems like there is a problem with simplejson library. Maybe you should uninstall it with pip uninstall simplejson if that does not work you can try downgrading the version of simplejson. You can pick from it's version history https://pypi.org/project/simplejson/#history for instance: pip install simplejson==3.17.0

erwin4u-alt commented 1 year ago

probably this was the issue. I've deleted simplejson and do not get an error message anymore. Unfortunately the raspi zero crash if I open a game in lichess. Probably the hardware isn't strong enough ... I'm not sure if it make sense to invest more time in this project with this hardware. But many thanks for your assistance!!!

karayaman commented 1 year ago

You are welcome. Actually, hardware requirements should be really low. But while using it with lichess sometimes communication delay occurs (1-2 seconds most of the time) which results in increased memory usage. Because, it stops processing the frames and stores them in memory until server responds. So, you may get it working with another chess software such as Lucas Chess

erwin4u-alt commented 1 year ago

I've installed on my MacBook an it work's well. Many thanks for this great job!!!