Abracadabra

Install SerpentAI on Windows 10

Python Environment

Python 3.6+ (with Anaconda)

Serpent.AI was developed taking full advantage of Python 3.6 so it is only natural that the Python requirement be for versions 3.6 and up.

Installing regular Python 3.6+ isn’t exactly difficult but Serpent.AI relies on a good amount of scientific computing libraries that are extremely difficult / impossible to compile on your own on Windows. Thankfully, the Anaconda Distribution exists and takes this huge weight off our collective shoulders.

Installing Anaconda 5.2.0 (Python 3.6)

Download the Python 3.6 version of Anaconda 5.2.0 and run the graphical installer.

The following commands are to be performed in an Anaconda Prompt with elevated privileges (Right click and Run as Administrator). It is recommended to create a shortcut to this prompt because every Python and Serpent command will have to be performed from there starting now.

Creating a Conda Env for Serpent.AI

conda create --name serpent python=3.6 (‘serpent’ can be replaced with another name)

Creating a directory for your Serpent.AI projects

mkdir SerpentAI && cd SerpentAI

Activating the Conda Env

conda activate serpent

3rd-Party Dependencies

Redis

Redis is used in the framework as the in-memory store for the captured frame buffers as well as the temporary storage of analytics events. It is not meant to be compatible with Windows! Microsoft used to maintain a port but it’s been abandoned since. This being said, that Redis version is sufficient and it outperforms stuff like running it in WSL on Windows 10. It will install as a Windows Service. Make sure you set it to start automatically.

Install Windows Subsystem for Linux (WSL)

  1. From Start, search for Turn Windows features on or off (type turn)
  2. Select Windows Subsystem for Linux (beta)

img

Once installed you can run bash on Ubuntu by typing bash from a Windows Command Prompt. To install the latest version of Redis we’ll need to use a repository that maintains up-to-date packages for Ubuntu and Debian servers like https://www.dotdeb.org which you can add to Ubuntu’s apt-get sources with:

1
2
3
4
$ echo deb http://packages.dotdeb.org wheezy all >> dotdeb.org.list
$ echo deb-src http://packages.dotdeb.org wheezy all >> dotdeb.org.list
$ sudo mv dotdeb.org.list /etc/apt/sources.list.d
$ wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -

Then after updating our APT cache we can install Redis with:

1
2
$ sudo apt-get update
$ sudo apt-get install redis-server

You’ll then be able to launch redis with:

1
$ redis-server --daemonize yes

Which will run redis in the background freeing your shell so you can play with it using the redis client:

1
2
3
4
5
$ redis-cli
$ 127.0.0.1:6379> SET foo bar
OK
$ 127.0.0.1:6379> GET foo
"bar"

Which you can connect to from within bash or from your Windows desktop using the redis-cli native Windows binary from MSOpenTech.

Build Tools for Visual Studio 2017

Some of the packages that will be installed alongside Serpent.AI are not pre-compiled binaries and will be need to be built from source. This is a little more problematic for Windows but with the correct C++ Build Tools for Visual Studio it all goes down smoothly.

You can get the proper installer by visiting https://www.visualstudio.com/downloads/ and scrolling down to the Build Tools for Visual Studio 2017 download. Download, run, select the Visual C++ build tools section and make sure the following components are checked (VSs are not installed):

  • Visual C++ Build Tools core features
  • VC++ 2017 version 15.7 v14.14 latest v141 tools
  • Visual C++ 2017 Redistributable Update
  • VC++ 2015.3 v14.00 (v140) toolset for desktop
  • Windows 10 SDK (10.0.17134.0)
  • Windows Universal CRT SDK

Installing Serpent.AI

Once all of the above had been installed and set up, you are ready to install the framework. Remember that PATH changes in Windows are not reflected in your command prompts that were opened while you made the changes. Open a fresh Anaconda prompt before continuing to avoid installation issues.

Go back to the directory you created earlier for your Serpent.AI projects. Make sure you are scoped in your Conda Env.

Run pip install SerpentAI

Then run serpent setup to install the remaining dependencies automatically.

Installing Optional Modules

In the spirit of keeping the initial installation on the light side, some specialized / niche components with extra dependencies have been isolated from the core. It is recommended to only focus on installing them once you reach a point where you actually need them. The framework will provide a warning when a feature you are trying to use requires one of those modules.

OCR

A module to provide OCR functionality in your game agents.

Tesseract

Serpent.AI leverages Tesseract for its OCR functionality. You can install Tesseract for Windows by following these steps:

  1. Visit https://github.com/UB-Mannheim/tesseract/wiki
  2. Download the .exe for version 3
  3. Run the graphical installer (Remember the install path!)
  4. Add the path to tesseract.exe to your %PATH% environment variable

You can test your Tesseract installation by opening an Anaconda Prompt and executing tesseract --list-langs.

Installation

Once you’ve validated that Tesseract has been properly set up, you can install the module with serpent setup ocr

GUI

A module to allow Serpent.AI desktop app to run.

Kivy

Kivy is the GUI framework used in the framework.

Once you are ready to test your Kivy, you can install the module with serpent setup gui and try to run serpent visual_debugger