FMP AudioLabs
B

Installation


In this notebook, we summarize some of the most important concepts that are helpful for installing Python and Jupyter using a package management system. For a quick start to install the environment underlying the FMP notebooks, please look at the FMP notebook on how to get started.

Package Management System

Conda is an open source package management system and environment management system that runs on Windows, macOS and Linux. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads and switches between environments on a local computer. It was created for Python programs, but it can package and distribute software for any language. Anaconda is a Python distribution with a package management system optimized for Python. It includes conda as well as standard scientific Python packages such as SciPy, NumPy and many others. The following steps and commands may be useful to get started:

  • Installation of Anaconda or Miniconda (slim version of Anaconda).
  • On Windows: Start with opening the terminal Anaconda Prompt.
    On Linux/MacOS: You can use a usual shell.
  • Verify that conda is installed: conda --version
  • Update conda (it is recommended to always keep conda updated to the latest version): conda update conda
  • Default environment is named base
  • Create a new environment and install a package in it. For example:
    conda create --name FMP python=3 numpy scipy matplotlib jupyter
    creates a Python environment including the packages numpy, scipy, matplotlib, and jupyter
  • List of all environments: conda env list
  • Activate environment: conda activate FMP
  • Python version in current environment: python --version
  • List packages contained in environment: conda list
  • Remove environment: conda env remove --name FMP
For a more detailed summary of important conda commands, we refer to the Conda Cheat Sheet.

Python Environment Files

To simplify the installation of Python and Jupyter, we recommend to create an environment from an environment.yml file, which exactly specifies the packages (along with specific versions). For example, such a file may look like this:

name: FMP channels: - defaults - conda-forge dependencies: - python==3.7.* - numpy==1.17.* - ...

To create the environment named FMP, you need to call
conda env create -f environment.yml

To update the environmen, you can call
conda env update -f environment.yml

Sometimes it may be easier to first remove the environment and than install it again:
conda env remove -n FMP
conda env create -f environment.yml

Once the environment has been installed, you need to activate it using:
conda activate FMP

The current FMP environment can be listed as follows:

In [1]:
import os

fn = os.path.join('..', 'environment.yml')
with open(fn, 'r', encoding='utf-8') as stream:
    env = stream.read()

print(env)
name: FMP

channels:
  - defaults
  - conda-forge

dependencies:
  - python=3.8.*
  - pip=20.0.*
  - numpy=1.19.*
  - scipy=1.5.*
  - matplotlib=3.3.*
  - ipython=7.10.*
  - jupyter=1.0.*
  - pandas=1.1.*
  - scikit-learn=0.23.*
  - ffmpeg=4.2.*
  - numba=0.56.*
  - jupyter_contrib_nbextensions=0.5.*
  - jupyter_client=6.1.*
  - pip:
    - mir-eval==0.5.*
    - nbstripout==0.3.*
    - music21==5.7.*
    - pretty_midi==0.2.*
    - librosa==0.8.*
    - soundfile==0.9.*
    - resampy==0.2.*

Spell Checker

The package jupyter_contrib_nbextensions contains various extension including a spell checker for markdown cells. To activate the spell checker, one needs to type the following commands (when having activated the environment):

jupyter contrib nbextension install --user
jupyter nbextension enable spellchecker/main
Acknowledgment: This notebook was created by Frank Zalkow and Meinard Müller.
C0 C1 C2 C3 C4 C5 C6 C7 C8