cutechess-cli running python engines under win7

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

cutechess-cli running python engines under win7

Post by brianr »

cutechess-cli under ubuntu works fine for me running python engines (like with neural nets).

I can't get it to work under Win7.

I have created a .bat file which runs the python files just fine from a cmd prompt.

This is in a virtual environment with cutechess-cli version 0.8.5.

cutechess-cli works fine for "typical".exe engines under win7.

If someone has this working and could please post and example that would be most helpful.

Thanks,
Brian
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: cutechess-cli running python engines under win7

Post by F. Bluemers »

You might have to hardcode the interpreter in your script,
I have python installed but it is not set in PATH.
Also the installer puts the interpreter in an akward place (C:\Users\Fonzy\AppData\Local\Programs\Python\Python36-32\python.exe)
edit: forgot to add that i never tried running python engines in cutechess myself
Last edited by F. Bluemers on Sat Aug 18, 2018 6:29 pm, edited 1 time in total.
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: cutechess-cli running python engines under win7

Post by brianr »

Thanks for the idea.

I can run a little dummy python "engine" that just does print('hitme') and that works, at least as far as starting python and I get the 'hitme' output in cutechess-cli with the -debug option. Of course, then those processes are terminated right away.

It may be something with passing parameters to the python script thru cutechess-cli.
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: cutechess-cli running python engines under win7

Post by brianr »

Well, things seem to work fine under Arena, but not cutechess-cli.

Now I'll have to try Winboard
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: cutechess-cli running python engines under win7

Post by F. Bluemers »

a part of my edit got lost,suggesting to edit engines.json
this seems to work a bit:
dowloaded the py files from sunfish to directory engines.tut
add to engines.json:

Code: Select all

 { 
      "command" : "C:\\Users\\Fonzy\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe -u xboard.py", 
      "name" : "sunfish",
      "protocol" : "xboard", 
	  "workingDirectory" : "C:\\Users\\Fonzy\\chess\\engines-tut"
   }, 
got timeloss though:

Code: Select all

4086 >sunfish(2): force
4087 >sunfish(2): result 1-0 {Black loses on time}
4088 >sunfish(2): ping 15
4088 >sunfish(3): force
4089 >sunfish(3): result 1-0 {Black loses on time}
4090 >sunfish(3): ping 19
4091 <sunfish(3): Error (unkown command): result 1-0 {Black loses on time}
4093 <sunfish(3): pong 19
4095 <sunfish(2): Error (unkown command): result 1-0 {Black loses on time}
4096 <sunfish(2): pong 15
Finished game 2 (sunfish vs sunfish): 1-0 {Black loses on time}
Score of sunfish vs sunfish: 1 - 3 - 0  [0.250] 4
Elo difference: -190.85 +/- nan
Finished match
4115 >sunfish(0): quit
well maybe i should tried different tc:

Code: Select all

cutechess-cli -debug -recover -ratinginterval 20 -engine conf="sunfish" -engine conf="sunfish" -games 2 -concurrency 6 -resign movecount=5 score=600 -rounds 2 -repeat -each book=GS_medium091230.bin tc=40/0:02  
40/0:10 :

Code: Select all

32925 >sunfish(4): usermove e2d2
32926 <sunfish(4):   1      -43        0             6  h2g2
32927 <sunfish(4):   2      -42        0             9  h2g2
32929 <sunfish(4):   3      -42        0            12  h2g2
32930 <sunfish(4):   4      -40        0            15  h2g2
32932 <sunfish(4):   5      -40        0            18  h2g2
32933 <sunfish(4):   6      -42        0            21  h2g2
33271 <sunfish(4):   7      -37       36          7348  h2g2
33273 <sunfish(4): move h2g2
33274 >sunfish(4): force
33274 >sunfish(4): result 1/2-1/2 {Draw by 3-fold repetition}
33276 >sunfish(4): ping 3
33276 >sunfish(5): force
33277 >sunfish(5): usermove h2g2
33278 >sunfish(5): result 1/2-1/2 {Draw by 3-fold repetition}
33279 >sunfish(5): ping 26
33280 <sunfish(4): Error (unkown command): result 1/2-1/2 {Draw by 3-fold repetition}
33283 <sunfish(4): pong 3
33284 <sunfish(5): Error (unkown command): result 1/2-1/2 {Draw by 3-fold repetition}
33286 <sunfish(5): pong 26
Finished game 3 (sunfish vs sunfish): 1/2-1/2 {Draw by 3-fold repetition}
Score of sunfish vs sunfish: 2 - 0 - 2  [0.750] 4
Elo difference: 190.85 +/- 451.93
Finished match
33378 >sunfish(0): quit
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: cutechess-cli running python engines under win7

Post by brianr »

Got it working.
Thanks for suggesting putting the engines in the Python directory.
Something is likely messed up with my PATHs.

What got this particular .py engine to work was adding a "stderrFile" entry in the engines.json which had been just : ""

This engine uses Keras and TF and it sends text to stderr at startup, which apparently was causing cutechess-cli to terminate the process if there was no stderr, although I don't know what might have happened to the default stderr (which I seem to recall defaults to sysout, but who knows).

The only reason I am trying to use cutechess-cli is for SPRT (although it can also randomly use a FEN or pgn file for opening positions, and Winboard can only do it sequentially, but that is minor).

BTW Winboard works beautifully, and unlike cutechess-cli, tourneys can be started, interrupted, and restarted, and you can run as many Winboard instances as you want for concurrency (which you can change on the fly as needed).
If it only had SPRT it would be wonderful.

Brian