DIY AI: Installation manuals

Andrew Tch
3 min readJul 27, 2017

This is a collection of “how to install things” supporting DIY AI series

Most of the software I use in DIY AI series has become a lot more user friendlier during last years. However, developing AI / ML systems will require to know how to use the console and installing some console tools. This story tries to collect all the links and manuals in one place.

Personally I use Mac but I will try to add information for other systems where possible.

Console

Package management

  • on Windows, you are stuck to old-fashioned “download & double click approach”
  • on Mac, install Homebrew — I use it the most unless mentioned otherwise
  • on Linux, use your built-in package manager — for Ubuntu, it is apt

Python

  • for Windows, download and install from here: https://www.python.org/downloads/
  • for Mac, use brew install python for Python 2.7 or brew install python3 for Python 3
  • for Linux, use your package manager (apt-get install python3 or similar command)

Most Python projects include dependencies (specified in requirements.txt file) that can be installed via pip install command (after you have installed python).

Last but not least, I recommend a good Python IDE — the best one is PyCharm, just go here — https://www.jetbrains.com/pycharm/download/ — to download free community edition.

PyCharm will allow to to code your scripts, run them (via Ctrl + R) or debug (via Ctrl + D). If you are very new to Python or feel a bit rusty, I recommend taking a Python course from Codecademy (it is free!).

Python 2 vs Python 3

Python currently has two versions — 2 and 3, with small differences. The differences (and process of porting code from 2 to 3) is well describrd int he following articles:

  1. https://www.digitalocean.com/community/tutorials/python-2-vs-python-3-practical-considerations-2
  2. https://www.digitalocean.com/community/tutorials/how-to-port-python-2-code-to-python-3
  3. https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04

When working with python 3 most of the tools are postfixed with letter 3 — pip becomes pip3, python becomes python3 and so on, which should be take in account when working with multiple python versions.

Virtualenv

As you develop different applications in Python, you may face the issue when they require different packages, different versions of the same package or different environments. In Python world, this issue is fixed using virtualenv package — a tool that allows creation of isolated Virtual Environments.

You can install virtualenv following the official guide here: https://virtualenv.pypa.io/en/stable/installation/ . To create a virtual environment in a particular folder, run virtualenv .; if you need a different version of Python, pass the executable path as the -p switch, like so: virtualenv . -p /usr/local/bin/python3.

To use (start) virtualenv, you need to execute source bin\activate (or bin\activate.bat on Windows) — see explanation here: https://virtualenv.pypa.io/en/stable/userguide/ .

When virtualenv is activated, you will see an addition to your command prompt with virtual environment name:

(venv1) # ~/Documents/nn/venv

If you see this prompt, then all commands (pip, python, etc) will be executed in your virtualenv configuration and all packages will be installed locally.

In most cases, lib/ and bin/ folders created by virtualenv are put into .gitignore file.

Fann

Fann is Fast Artificial Neural Network package.

You should install fann from here — http://leenissen.dk/fann/wp/help/installing-fann/

For Mac, you can do brew install fann instead of installing manually.

Afterwards, you need to install python bindings — pip install fann2

--

--