Windows 10 Tablet to run Picochess and conect to DGT board?

500 views
Skip to first unread message

Shandore

unread,
Sep 25, 2021, 12:00:34 AM9/25/21
to PicoChess
I have a win 10 surface pro 7 tab.
Could I run Pico in virtualbox on the tablet and not use a PI or DGT3000 at all?
If possible, is there a tutorial or just basic walkthrough?

Thanks

RandyR

unread,
Sep 26, 2021, 12:34:27 PM9/26/21
to PicoChess
That should work (I don't know of any tutorial or walkthrough for it), as long as the Linux virtual machine can see your chess board (USB or Bluetooth). I would suggest using a Debian-based OS in Virtualbox and install Picochess by copying the /opt/picochess folder from a current v3 image, and install the python packages and other requirements using the manual installation instructions as a guide. You will need to re-compile the chess engines (and MAME/MESS, if you want it) for the architecture (e.g. x86-64), create a folder in /opt/picochess/engines to match the architecture (x86-64) and edit any python programs or .ini files in the picochess folder tree that currently points to armv7l. You will need to utilize the web server to make the selections you would have used the clock for.

You can have a look at Dirk's GitHub site which has most of the picochess code (due to size constraints it is missing the MAME/MESS files).

Randy

RandyR

unread,
Sep 27, 2021, 2:29:18 PM9/27/21
to PicoChess
I spent some time today seeing if this would work and, yes, I have PicoChess running on a Windows 10 laptop using Virtualbox with Debian 11 as the guest OS and a USB DGT board. I bring up the webserver locally (127.0.0.1) in Debian and can make menu changes as usual. I only have Stockfish 14 in the engines/x86_64 folder but I played a quick Fool's Mate to test PicoTutor.

Randy

Shandore

unread,
Sep 29, 2021, 5:10:46 AM9/29/21
to PicoChess
THANK YOU RANDY!!!
i just recived my dgt board and setup frtz successfully and chess for android via bluetooth.

have just downloaded a ubuntu image from osboxes, now to follow your steps

Shandore

unread,
Sep 30, 2021, 3:09:47 AM9/30/21
to PicoChess
latest virtual box
latest ubuntu from osboxes.org

dowloaded lite image version of picochess from the group

copied /opt/picochess into virtualbox opt/picochess

edit last line of pico.ini to point to x86_64

edit ini  dgipi = false

created x86_64 dir in engines

copied stockfish from test directory [because that was already an x86_64]

i installed everything except git.

installed pip and updated

did NOT set up python developer environment.

edited python files to point to x86_64

ran pico with sudo python3 /opt/picochess/picochess.py


result = crash

 sudo python3 /opt/picochess/picochess.py
Traceback (most recent call last):
  File "/opt/picochess/picochess.py", line 3999, in <module>
    main()
  File "/opt/picochess/picochess.py", line 2489, in main
    handler = RotatingFileHandler('logs' + os.sep + args.log_file, maxBytes=1.4 * 1024 * 1024, backupCount=5)
  File "/usr/lib/python3.9/logging/handlers.py", line 153, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
  File "/usr/lib/python3.9/logging/handlers.py", line 58, in __init__
    logging.FileHandler.__init__(self, filename, mode=mode,
  File "/usr/lib/python3.9/logging/__init__.py", line 1146, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.9/logging/__init__.py", line 1175, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding,
FileNotFoundError: [Errno 2] No such file or directory: '/home/osboxes/logs/picochess.log'



Rather than trouble shoot all the variables as i really dont know what im doing.
is there a place to download the debian image you created?

also how does one compile engines for picochess for their own OS

also... webserver? does that need to be enabled in picochess ini?

Shandore

unread,
Sep 30, 2021, 6:05:51 AM9/30/21
to PicoChess
created a log file, then re run prog, now i get this, and it just hangs

sboxes@osboxes:~$ sudo python3 /opt/picochess/picochess.py
[sudo] password for osboxes:  
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/opt/picochess/dispatcher.py", line 187, in run
    self._process_message(message, dev)
  File "/opt/picochess/dispatcher.py", line 122, in _process_message
    self.dgtmenu.enable_picochess_displayed(dev)
  File "/opt/picochess/dgt/menu.py", line 340, in enable_picochess_displayed
    self.updt_tags = get_tags()
  File "/opt/picochess/utilities.py", line 199, in get_tags
    tags = [(tags, tags[1] + tags[-2:]) for tags in do_popen([git, 'tag'], log=False).split('\n')[-4:-1]]
  File "/opt/picochess/utilities.py", line 185, in do_popen
    stdout, stderr = Popen(command, stdout=PIPE, stderr=PIPE).communicate()
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'
Traceback (most recent call last):
  File "/opt/picochess/picochess.py", line 3999, in <module>
    main()
  File "/opt/picochess/picochess.py", line 2636, in main
    engine_file = eng_ini[engine_tries]['file']
IndexError: list index out of range
 
 

RandyR

unread,
Sep 30, 2021, 11:54:36 AM9/30/21
to PicoChess
Hi Shane (?),

I installed Debian 11 using the amd64 DVD image, not a pre-made VM. But I don't think that's your issue. Here are some ideas (I assume you used my v3 DGTPi Lite image to copy over the picochess folder. Also, run 'sudo apt update' and 'sudo apt full-upgrade' then reboot to ensure you are using the latest version of Ubuntu - or whatever OS you decide to use):

1. you can find precompiled engines on the internet but VirtualBox doesn't expose all instruction set capabilities of the host cpu architecture so you'll probably need to compile them yourself. You'll need to install the build tools (sudo apt install build-essential) and get the source code (e.g. stockfish) and follow the instruction to compile. OR - You can try the precompiled releases (BMI2 and AVX2 won't run, at least in Debian 11 VM so try POPCNT, SSSE3 or plain 64-bit). Place the executable in the engines/x86_64 folder and rename it to 'a-stockf' (this is important). Copy over the 'a-stockf.uci' and 'engines.ini' files from the armv7l folder. Edit engines.ini to remove every section except '[a-stockf]'. Test the a-stockf engine to ensure it runs ('./a-stockf' should run).

2. change any references to 'armv7l' in any .py/.ini/.uci files in the picochess tree (disregard the ones under engines/armv7l) to 'x86_64' using a text editor (e.g. nano). You can find them using the following command from the picochess folder:

grep --include=\*.{py,ini,uci} -rn . -e "armv7l"

or create a sed command to do it automatically :^)

3. the webserver is enabled by default (but if you change ownership of the /opt/picochess tree and don't run picochess as root (via sudo), you'll need to change the webserver port in picochess.ini to e.g. 8080 - then use 127.0.0.1:8080 in the address bar of the browser running on the VM to see the interface). If running with 'sudo' you can use port 80 and just type the ip address in the address bar (e.g. 127.0.0.1).

4. remove any lines in picochess.ini that start with 'engine =' or 'engine-level ='. Picochess will find the engine.

5. ensure all prerequisites are installed (should only need these now - and some may already be installed):

sudo apt install git avahi-daemon avahi-discover libnss-mdns sox python3-dev python3-pip libffi-dev libssl-dev

cd /opt/picochess

sudo pip3 install --upgrade -r requirements.txt

6. carry out the following fixes to python packages spur and chess (change python3.x to whatever version is installed. :
  • rename /usr/local/lib/python3.x/dist-packages/spur/ssh.py as ssh.py0321 and replace with ssh.py from here: https://github.com/tfromme/spur.py . Ensure ownership matches the other files in that folder (i.e. copy using sudo from wherever you downloaded to).
  • edit  /usr/local/lib/python3.x/dist-packages/chess/uci.py as follows
around line 949 change

        if movestogo is not None and movestogo > 0:

to 

        if movestogo is not None and int(movestogo) > 0:

NOTE: indenting is important in python! Ensure it is the same.

6. cd to the /opt/picochess folder then run 'sudo python3 picochess.py'. 

Note: you can change ownership of the /opt/picochess tree to your username so sudo isn't required (sudo was needed on the DGTPi since root hardware access was required):

sudo chown sboxes:sboxes -R /opt/picochess

7. Open a browser on the VM and type in the webserver address as mentioned in step 3. Hopefully it's all working now.

Once picochess is working with one engine, you can add more.

I don't think I'm forgetting anything. But, I'm going from memory. Let me know how you make out.

Randy

RandyR

unread,
Sep 30, 2021, 12:17:34 PM9/30/21
to PicoChess
Precompiled stockfish 14 POPCNT, SSSE3 & 64-bit all run on VirtualBox for me on my 8th-Gen Intel Core i7-8550U laptop (64-bit benchmarked the most nodes/sec).

Randy

RandyR

unread,
Sep 30, 2021, 12:24:56 PM9/30/21
to PicoChess
Compiling SF14 myself (using 'make -j2 profile-build ARCH=x86-64-sse41-popcnt') was noticeably faster than the precompiled ones that would run. My VM is set to 4 processors and 4096 MB memory.

Randy

Shandore

unread,
Oct 9, 2021, 5:44:12 AM10/9/21
to PicoChess
Hi Randy,
Shane it is :)

 Been giving it a good try on the PC with virtual box,

Stockfish wont run   "NO SUCH FILE OR DIRECTORY"

and i used chmod -R 777 picochess to change all permissions

Google doesnt say much about it

Capture.JPG

Randy Reade

unread,
Oct 9, 2021, 10:33:47 AM10/9/21
to pico...@googlegroups.com
Hi Shane. The file is 'a-stockf' as can be seen in the picture. Also, I assume it is the x86-64 version that you downloaded and renamed.

Randy

--
You received this message because you are subscribed to a topic in the Google Groups "PicoChess" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/picochess/IG4d9XGk6E4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to picochess+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/picochess/5c62db8f-2ce5-48ea-af43-ce228011c95dn%40googlegroups.com.

Shandore

unread,
Oct 9, 2021, 5:01:39 PM10/9/21
to PicoChess
Oh Man!!! I am so embarressed. Thanks.

Shandore

unread,
Oct 10, 2021, 1:33:53 AM10/10/21
to PicoChess
I used this command to find and replace. Is that okay? I pieced it together from stackoverflow

sudo grep -rl "armv7l"  --include=\*.{py,ini,uci} | xargs sed -i.bak 's/armv7l/x86_64/g'

Pico Chess Loads, no errors in the terminal.

no board connected at the moment.

But the computer wont move.

if  I use the onscreen buttons, i eventually get a crash " out of index range" type issue.

also when pico crashes, how do i shut down the webserver from the terminal. closing the terminal kills pico, but not the webserver.

Im super excited by the way :)


Capture.JPG
On Sunday, October 10, 2021 at 1:33:47 AM UTC+11 RandyR wrote:

RandyR

unread,
Oct 10, 2021, 11:02:16 AM10/10/21
to PicoChess
Hi Shane,

You have to add the usb device in virtualbox to make it visible to the Linux VM. Plug it in to the PC and it should become visible to add - mine had "FTDI" in the name (I'm not at that PC right now so if you still can't figure it out let me know and I'll check it). Also, I had to have the board plugged in before starting the VM for it to be seen (at least initially - not sure if it's always like that).

When PicoChess crashes and the web server keeps running you'll have to release the port ('fuser -k 8080/tcp') or with sudo if you started PicoChess as root. You should then see 'closed' in the DGT Clock area. Then you can reuse the port when PicoChess starts again. Also, you won't get any engine response until the board is connected (unless using console mode in picochess.ini).

Randy

Shandore

unread,
Oct 15, 2021, 8:39:59 PM10/15/21
to PicoChess
AMAZING, JUST AMAZING!!  Can pretty much play on any widows computer, just by running the VM

Works Very Well, Web server is FANTASTIC.

Pretty much everything works straightaway.

There is an audio conflict between the webserver voice and picocchess voice.

If  I dont connect to webserver [via firfox for example] then the audio run by picochess is GlaDOS [VERY COOL]
If I connect to webserver then audio switched to an english male voice, and no more GlaDOS.

I am happy to upload this VM somewhere for others to use once its nice and neat. Make it auto logon and auto load picochess and  web page.

No need for PI if any1 has a windows tablet or laptop.

RandyR

unread,
Oct 16, 2021, 2:04:33 PM10/16/21
to PicoChess
Shane,

Are you running the webserver in the VM or on the host?

Shandore

unread,
Oct 16, 2021, 6:17:43 PM10/16/21
to PicoChess
Randy, webserver is run in VM, accessed by Firefox in VM, essentially everything is inside VM [Ubuntu]

Host is windows 10, but does nothing except run virtual box in this case.

Randy Reade

unread,
Oct 16, 2021, 6:49:39 PM10/16/21
to pico...@googlegroups.com
I would have thought the VM would allow more than one audio stream. Maybe you can test if you can play an audio file while an mp3 or YouTube video is playing, both in the VM. Another option might be to open the web display on the host if the proper port is open.

Randy

Shandore

unread,
Oct 16, 2021, 7:00:21 PM10/16/21
to PicoChess
Hi, Got it to work,

I set the Vm network  NAT to bridged in virtual box options.

installed net tools on ubuntu  and used ifconfig to get ipadress

opened port 8080 on ubuntu just to be sure.

accessed the server from windows 10 host on chrome. using ip4 address

its perfect, and for some reason much quicker to respond.

let me know if u want this copy uploaded anywhere for others

Randy Reade

unread,
Oct 16, 2021, 7:16:22 PM10/16/21
to pico...@googlegroups.com
That's great,  Shane. Thanks for the solution. 

Randy

Shandore

unread,
Oct 16, 2021, 7:38:09 PM10/16/21
to PicoChess
Thank you sincerely. !

RandyR

unread,
Oct 18, 2021, 10:20:15 AM10/18/21
to PicoChess
Shane,

I had a look at the sound issue. I'm actually hearing both sound streams - PicoChess and the spoken moves in the web browser within the VM. If you want to run the adjust or mute the web browser stream inside the VM, you can install the Pulse Audio Volume Control and when you start (for e.g.) Firefox, open pavucontrol and either adjust the slider for the 'speech-dispatcher-espeak-ng: playback' or just press the Mute Audio button to the right. For some reason, muting the tab in Firefox doesn't stop the spoken sounds. 

Randy
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages