Installing CamChess


You can download CamChess from here by clicking the Code button. The file paths at the beginning of CamChess.py should configure themselves to work for Linux, an Apple Mac and Windows. They are based on the assumption that you have set up a CamChess directory in your home directory, and that the relevant files are in that directory. You can edit any of these file paths. (Chess_Games.txt contains any games that you have saved, and the Pieces directory contains images of the chess pieces for display on chess diagrams.)

The file path for Stockfish is Linux specific. That is where Stockfish will be installed if you install it from the repository. If you are using Windows, you will need to edit that path to that of the Stockfish executable. You can download Stockfish from here. (You can use another engine, but I do not know another that supports the Skill Level setting. If that setting is not supported by the engine, the Level button will not work. The options that the engine supports will be printed in the terminal when CamChess starts up.)
I used a Raspberry Pi 4B to run CamChess. I installed OpenCV from source code using the instructions here. I installed python-chess and the Python image modules from a terminal using:

sudo apt update
sudo apt full-upgrade
sudo pip install python-chess
sudo apt-get install python3-pil python3-pil.imagetk

I installed Stockfish using Menu > Preferences > Add/Remove Software.

You can run CamChess on any Unix based system (Raspberry Pi, Linux or a Mac) from a terminal by typing:

python3 ~/CamChess/CamChess.py

You can set up a desktop shortcut for CamChess by right clicking on the desktop and selecting New File. Insert the following code into the file:

[Desktop Entry]
Name=CamChess
Icon=/home/pi/CamChess/Images/Icon.png
Exec=python3 /home/pi/CamChess/CamChess.py
Type=Application
Encoding=UTF-8
Terminal=true
Categories=Games

You can then launch CamChess by double clicking on the CamChess icon, and selecting Execute in Terminal. (You can also add CamChess to the Raspberry menu using Menu > Preferences > Main Menu Editor.) Alternatively, you can run CamChess form an Integrated Development Environment (IDE). Geany and Thonny are preinstalled on Raspberry OS.


With Xubuntu 20.04 on an old desktop PC, I installed the necessary Python modules with:

sudo apt update
sudo apt full-upgrade
sudo apt-get install python3-pip
sudo pip3 install python-chess
sudo pip3 install opencv-contrib-python
sudo apt-get install python3-pil python3-pil.imagetk

(N.B. It may be sufficient to install opencv-python, which contains the main OpenCV modules. opencv-contrib-python also contains additional unofficial modules.) I also installed Stockfish from the repository.


Here are instructions for installing Python 3 with Idle on Windows from the official source. (Idle is the traditional beginners' Python IDE. Idle is not great, but it is reliable.) Here are the official instructions for installing OpenCV and NumPy on Windows. You should be able to install the remaining modules with pip, which comes preinstalled with Python 3.4 or greater. In particular, you should be able to install python-chess by typing on the command line:

pip python-chess

If anything else is missing, you should be able to fix that by looking at the error message and asking Google.


Here are instructions for installing OpenCV on an Apple Mac.

Comments