kalliope-project/MMM-kalliope

How to install this from vanilla MM?

E3V3A opened this issue · 8 comments

E3V3A commented

How can I install and use this module from vanilla fresh MM install?

I have no idea what is vanilla.

E3V3A commented

:) It's just a word for "fresh", "orginal" or untouched.
What I mean is, starting from a new MM install.

Module to bind Kalliope with your Magic Mirror.

I.e. clarifying what that means.
What else do we need to install?
Dependencies etc?

Oh, ok :).
Actually you need to have an install of Kalliope project. You can just install it from the pre compiled image or manually following the doc.
Then, on Kalliope you use the dedicated neuron to talk with this module.

Feel free to come on the gitter chat of the Kalliope project if you are stuck somewhere.

E3V3A commented

So we need to install 3 things to get this to work, apart from all the dependencies? Is that right?
Can this be used without pulseaudio?

Yes it works with alsa.

And so you need 3 things:

  • MM
  • Kalliope
  • Kalliope neuron
  • MM Kalliope Module
E3V3A commented

So how can we get all installed in one go?

I'm not familiar with Ansible, but I looked at the ansible script:

# Use this playbook with ansible to install kalliope on a remote Rpi
# After a fresh install of a Rpi, you only need to active ssh
# sudo systemctl enable ssh
# sudo systemctl start ssh
# the target pi must be declared in your inventory (e.g: /etc/ansible/hosts)
# e.g: kalliope_rpi ansible_host=192.0.2.50
# usage:
# ansible-playbook -vK rpi_kalliope_install.yml
# with version
# ansible-playbook -vK rpi_kalliope_install.yml -e "kalliope_branch_to_install=dev"
# connect to the pi and flush history
# cat /dev/null > /home/pi/.bash_history && history -c  && exit

- name: Install Kalliope on Rpi
  hosts: "{{ targets | default('rpi') }}"
  remote_user: pi
  become: True

  vars:
    kalliope_branch_to_install: "master"
    starter_kits:
      - name: "kalliope_starter_cs"
        repo: "https://github.com/kalliope-project/kalliope_starter_cs.git"
      - name: "kalliope_starter_fr"
        repo: "https://github.com/kalliope-project/kalliope_starter_fr.git"
      - name: "kalliope_starter_de"
        repo: "https://github.com/kalliope-project/kalliope_starter_de.git"
      - name: "kalliope_starter_en"
        repo: "https://github.com/kalliope-project/kalliope_starter_en.git"
      - name: "kalliope_starter_it"
        repo: "https://github.com/kalliope-project/kalliope_starter_it.git"

  tasks:
    - name: Set hostname
      hostname:
        name: "kalliope"

    - name: Install required packages
      apt:
        name: "{{item}}"
        state: present
      with_items:
        - git
        - python-dev
        - libsmpeg0
        - libttspico-utils
        - libsmpeg0
        - flac
        - dialog
        - libffi-dev
        - libssl-dev
        - portaudio19-dev
        - build-essential
        - sox
        - libatlas3-base
        - mplayer
        - libyaml-dev
        - libpython2.7-dev
        - pulseaudio
        - pulseaudio-utils
        - libav-tools
        - libportaudio0
        - libportaudio2
        - libportaudiocpp0
        - portaudio19-dev
        - python-yaml
        - python-pycparser
        - python-paramiko
        - python-markupsafe
        - apt-transport-https

    - name: Clone the project
      git:
        repo: "https://github.com/kalliope-project/kalliope.git"
        dest: "/home/pi/kalliope"
        version: "{{ kalliope_branch_to_install }}"
        accept_hostkey: yes

    - name: Install Kalliope
      shell: python setup.py install
      args:
        chdir: /home/pi/kalliope

    - name: Clone starter kits
      git:
        repo: "{{ item.repo }}"
        dest: "/home/pi/{{ item.name }}"
        version: "master"
        accept_hostkey: yes
with_items: "{{ starter_kits }}"

A few things:

  • First of all, the installation has a few duplicates:
- libportaudio0
- libportaudio2
- libsmpeg0
- portaudio19-dev

(Why are both libportaudio's needed?)

  • Then I would prefer to avoid pulseaudio. Is it necessary?
  • Why do you need to flush Bash history?
  • What does the 'kalliope_rpi ansible_host' do? (Should it be the same as for MM server?)

I also looked at the installation bash script:

#!/usr/bin/env bash

# This script will install automatically everything needed for Kalliope
# usage: ./rpi_install_kalliope.sh [<branch_name>]
# E.g: ./rpi_install_kalliope.sh dev
# If no branch are set, the master branch will be installed

# name of the branch to install
branch="master"

# get the branch name to install from passed arguments if exist
if [ $# -eq 0 ]
  then
    echo "No arguments supplied. Master branch will be installed"
else
    branch=$1
    echo "Selected branch name to install: ${branch}"
fi

echo "Installing python pip..."
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
echo "Installing python pip... [OK]"

# install packages
echo "Installing system packages..."
sudo apt-get update
sudo apt-get install -y git python-dev libsmpeg0 libttspico-utils libsmpeg0 \
flac dialog libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential \
libssl-dev libffi-dev sox libatlas3-base mplayer libyaml-dev libpython2.7-dev pulseaudio pulseaudio-utils libav-tools

# this is used to help the RPI
sudo apt-get install -y libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo apt-get install -y libffi-dev python-yaml python-pycparser python-paramiko python-markupsafe apt-transport-https
echo "Installing system packages...[OK]"

echo "Cloning the project"
# clone the project
git clone https://github.com/kalliope-project/kalliope.git
echo "Cloning the project...[OK]"

# Install the project
echo "Installing Kalliope..."
cd kalliope
git checkout ${branch}
sudo python setup.py install
echo "Installing Kalliope...[OK]"

This look alright except the forceed install of PIP which most people already have out-of-the-box.

Yes use the script like this.

bash -c "$(curl -sL https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh)"

It's better to install pip from the python setup. Because then you can update it via pip install upgrade pip. If you install it via the Debian package it will be stuck in the installed version.
Up to you..

Thanks for you feedback. I've created a PR on the main project to push up the installation script.

I close the issue. Fell free to come on Gitter to talk with the community directly if you have trouble during the installation.