Getting stockfish to work on Android using p4a

139 views
Skip to first unread message

Abstract Donut

unread,
Jan 2, 2020, 2:19:07 AM1/2/20
to Kivy users support
Hi, I have an app built with pythonforandroid, which runs perfectly until I add stockfish functionality.

    ...
I/python:    File "/home/user/.local/share/python-for-android/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/subprocess.py", line 1516, in _execute_child
I/python:  PermissionError: [Errno 13] Permission denied: 'stockfish'
    Python for android ended.
I/python:  Exception ignored in: <function Stockfish.__del__ at 0xd279efa8>
I/python:  Traceback (most recent call last):
I/python:    File "/home/user/.local/share/python-for-android/build/python-installs/chess/stockfish.py", line 140, in __del__
I/python:  AttributeError: 'Stockfish' object has no attribute 'stockfish'
I/TMSDISP: AcsAndroidVirtualDisplayIntfImpl::~AcsAndroidVirtualDisplayIntfImpl - Enter
    AcsAndroidVirtualDisplayIntfImpl::~AcsAndroidVirtualDisplayIntfImpl - Enter2
    AcsAndroidVirtualDisplayIntfImpl::~AcsAndroidVirtualDisplayIntfImpl - mSource2
    AcsAndroidVirtualDisplayIntfImpl::~AcsAndroidVirtualDisplayIntfImpl - Exit
Process 4572 terminated.

I don't really know how stockfish works though or where to start fixing this. Perhaps my app doesn't have permission to access the engine itself? But that still leaves me wondering where the attribute error comes from. Any insight into how I can get stockfish working with android? Is this a simple fix or will it require a lot of legwork and hacking around?

Robert Flatt

unread,
Jan 2, 2020, 10:45:33 PM1/2/20
to Kivy users support
Google is a great resource for questions like this:

Stockfish is written in c++ , the implications for Python for Android are documented.

However there is a pre-compiled binary for android:
"What you're getting: just the Stockfish engine. You will need to use your own UCI-compatible chess program."

Your mission should you choose to accept it, is to figure out how/where to make these things play together. Enjoy.

Alexander Taylor

unread,
Jan 3, 2020, 4:42:35 PM1/3/20
to Kivy users support
For what it's worth, a precompiled binary should be fairly straightforward to get working. https://play.google.com/store/apps/details?id=net.inclem.lazybaduk is a similar concept using a baduk ai instead.
Reply all
Reply to author
Forward
0 new messages