Before moving ahead, we need to set up Python and all the packages required to run the code examples. For all the code examples in this book, we will be using Python 3.4. All the example code in the book is also available on GitHub at https://github.com/PacktPublishing/HandsOnMarkovModelswithPython. We highly recommend using Miniconda to set up your environment for running the examples. Miniconda can be downloaded from https://conda.io/miniconda.html.
Installing Python and packages
Installation on Windows
Miniconda can be installed on a Windows system by just double-clicking on the downloaded .exe file and following the installation instructions. After installation, we will need to create a conda environment and install all the required packages in the environment. To create a new Python 3.4 environment with the name hmm, run the following command:
conda create -n hmm python=3.4
After creating the environment, we will need to activate it and install the required packages in it. This can be done using the following commands:
activate hmm
conda install numpy scipy
Installation on Linux
On Linux, after downloading the Miniconda file, we will need to give it execution permissions and then install it. This can be done using the following commands:
chmod +x Miniconda.sh
./Miniconda.sh
After executing the file, we can simply follow the installation instructions. Once installed, we will need to create a new environment and install the required packages. We can create a new Python 3.4 environment with the name hmm using the following commands:
conda create -n hmm python=3.4
Once the environment has been created, we will need to activate it and install the packages inside it using the following:
source activate hmm
conda install numpy scipy