sunfish icon indicating copy to clipboard operation
sunfish copied to clipboard

chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 127)

Open sugizo opened this issue 2 years ago • 12 comments

$ uname -a
Darwin sugizo.local 16.7.0 Darwin Kernel Version 16.7.0: Sun Jun  2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64 x86_64

$ git clone https://github.com/thomasahle/sunfish
$ cd sunfish

$ tools/fancy.py -cmd ./sunfish.py
Traceback (most recent call last):
  File "/Users/sugizo/Downloads/sunfish/tools/fancy.py", line 284, in <module>
    asyncio.run(main())
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/sugizo/Downloads/sunfish/tools/fancy.py", line 234, in main
    engine = await load_engine_from_cmd(args.cmd, debug=args.debug)
  File "/Users/sugizo/Downloads/sunfish/tools/fancy.py", line 40, in load_engine_from_cmd
    _, engine = await chess.engine.popen_uci(cmd.split())
  File "/Users/sugizo/Downloads/test0/lib/python3.9/site-packages/chess/engine.py", line 2681, in popen_uci
    await protocol.initialize()
  File "/Users/sugizo/Downloads/test0/lib/python3.9/site-packages/chess/engine.py", line 1429, in initialize
    return await self.communicate(UciInitializeCommand)
  File "/Users/sugizo/Downloads/test0/lib/python3.9/site-packages/chess/engine.py", line 1094, in communicate
    return await command.result
chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 127)

sugizo avatar Feb 11 '23 22:02 sugizo

I'm seeing the same issue using Python 3.10.6 on Ubuntu 22.04.1.

I also tried pypy3.6-7.1.0 (listed at the bottom of the README) and got a type error when executing sunfish.py directly:

$ ./sunfish.py
Traceback (most recent call last):
  File "./sunfish.py", line 261, in <module>
    Entry = namedtuple("Entry", "lower upper", defaults=(-MATE_UPPER, MATE_UPPER))
TypeError: namedtuple() got an unexpected keyword argument 'defaults'

I think some clarification regarding which Python versions are supported is very much needed, especially since ./sunfish.py has a hashbang referring to PyPy3, while ./tools/fancy.py uses /usr/bin/env python3

codethief avatar Feb 13 '23 23:02 codethief

git clone https://github.com/thomasahle/sunfish
cd sunfish
python ./sunfish.py

result no error occured, just loading on terminal

expected result like on github readme

$ python ./sunfish.py
Playing against sunfish 2023.
Do you want to be white or black? black
  1 ♖ ♘ ♗ ♔ ♕ ♗ ♘ ♖
  2 ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
  3
  4
  5
  6
  7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
  8 ♜ ♞ ♝ ♚ ♛ ♝ ♞ ♜
    h g f e d c b a

Score: 23, nodes: 11752, nps: 13812, time: 0.9
 My move: d4
  1 ♖ ♘ ♗ ♔ ♕ ♗ ♘ ♖
  2 ♙ ♙ ♙ ♙   ♙ ♙ ♙
  3
  4         ♙
  5
  6
  7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
  8 ♜ ♞ ♝ ♚ ♛ ♝ ♞ ♜
    h g f e d c b a

Your move (e.g. c6 or g8h6): Nf6

sugizo avatar Feb 15 '23 00:02 sugizo

@sugizo

result no error occured, just loading on terminal

What do you mean by "just loading"? Also, which Python version (on which OS) are you using?

codethief avatar Feb 19 '23 19:02 codethief

Unfortunately sunfish.py can't use env, since it needs the -u argument added to python.

Regrading default values for namedtuple, I believe that requires Python 3.7.

thomasahle avatar Feb 24 '23 04:02 thomasahle

so what do we do now

yirod3721 avatar Feb 26 '23 18:02 yirod3721

@thomasahle Like @yirod3721 I'm not entirely sure what to make of your comment, given that I also tried to run Sunfish

using Python 3.10.6 on Ubuntu 22.04.1.

Maybe you could specify the Python versions Sunfish runs with fine, using e.g. a .tool-versions file? Alternatively, a devbox.json or, maybe even better, a Dockerfile?

codethief avatar Feb 28 '23 09:02 codethief

$ uname -a
Darwin sugizo.local 16.7.0 Darwin Kernel Version 16.7.0: Sun Jun  2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64 x86_64
$ python -V
Python 3.9.13

just loading means no error occured, but no respond either,

loading is the loading animated on top of terminal is rounding

sugizo avatar Mar 01 '23 04:03 sugizo

Same problem here. I don't know how to fix it yet.

doctorvanmartin avatar Mar 06 '23 16:03 doctorvanmartin

Same problem here. I don't know how to fix it yet.

Solved.

sudo apt install pypy3

run as:

./tools/fancy.py -cmd ./sunfish.py

doctorvanmartin avatar Mar 06 '23 20:03 doctorvanmartin

not work too when tested on google colab steps

!apt install -y pypy3
!git clone https://github.com/thomasahle/sunfish

execute !cd sunfish && python ./sunfish.py

result same like tested on mac just loading means no error occured, but no respond either,

loading is the loading animated on top of terminal is rounding

execute !cd sunfish/tools/fancy.py -cmd ../sunfish.py

result /bin/bash: line 0: cd: too many arguments

sugizo avatar May 16 '23 20:05 sugizo

@julupanter Which version of PyPy did you install exactly?

codethief avatar May 17 '23 12:05 codethief

@julupanter What version of PyPy did you install exactly?

The task was performed on a virtual machine that is no longer accessible, but at the time, it was the latest available. The virtual machine was running Ubuntu 22.10. I hope this information helps

doctorvanmartin avatar May 22 '23 10:05 doctorvanmartin