{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\"FMP\"\n", "\"AudioLabs\"\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\"B\"\n", "

Installation

\n", "
\n", "\n", "
\n", "\n", "

\n", "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.\n", "

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Package Management System\n", "\n", "[Conda](https://conda.io/docs/) 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](https://anaconda.org/) 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:\n", "\n", "* Installation of Anaconda or [Miniconda](https://conda.io/miniconda.html) (slim version of Anaconda). \n", "* On Windows: Start with opening the terminal `Anaconda Prompt`.
\n", " On Linux/MacOS: You can use a usual shell.\n", "* Verify that conda is installed: `conda --version`\n", "* Update conda (it is recommended to always keep conda updated to the latest version): `conda update conda` \n", "* Default environment is named `base`\n", "* Create a new environment and install a package in it. For example: \n", " `conda create --name FMP python=3 numpy scipy matplotlib jupyter` \n", " creates a Python environment including the packages `numpy`, `scipy`, `matplotlib`, and `jupyter`\n", "* List of all environments: `conda env list`\n", "* Activate environment: `conda activate FMP`\n", "* Python version in current environment: `python --version`\n", "* List packages contained in environment: `conda list`\n", "* Remove environment: `conda env remove --name FMP`\n", "\n", "
For a more detailed summary of important conda commands, we refer to the Conda Cheat Sheet.\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python Environment Files\n", "\n", "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:\n", "\n", "
\n", "name: FMP\n", "channels:\n", " - defaults\n", " - conda-forge\n", "dependencies:\n", " - python==3.7.*\n", " - numpy==1.17.*\n", " - ...\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To create the environment named `FMP`, you need to call \n", "`conda env create -f environment.yml` \n", "\n", "To update the environmen, you can call \n", "`conda env update -f environment.yml`\n", "\n", "Sometimes it may be easier to first remove the environment and than install it again: \n", "`conda env remove -n FMP` \n", "`conda env create -f environment.yml` \n", "\n", "\n", "Once the environment has been installed, you need to activate it using: \n", "`conda activate FMP` \n", "\n", "The current `FMP` environment can be listed as follows:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-02-15T09:01:44.048184Z", "iopub.status.busy": "2024-02-15T09:01:44.047897Z", "iopub.status.idle": "2024-02-15T09:01:44.054192Z", "shell.execute_reply": "2024-02-15T09:01:44.053385Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "name: FMP\n", "\n", "channels:\n", " - defaults\n", " - conda-forge\n", "\n", "dependencies:\n", " - python=3.8.*\n", " - pip=20.0.*\n", " - numpy=1.19.*\n", " - scipy=1.5.*\n", " - matplotlib=3.3.*\n", " - ipython=7.10.*\n", " - jupyter=1.0.*\n", " - pandas=1.1.*\n", " - scikit-learn=0.23.*\n", " - ffmpeg=4.2.*\n", " - numba=0.56.*\n", " - jupyter_contrib_nbextensions=0.5.*\n", " - jupyter_client=6.1.*\n", " - pip:\n", " - mir-eval==0.5.*\n", " - nbstripout==0.3.*\n", " - music21==5.7.*\n", " - pretty_midi==0.2.*\n", " - librosa==0.8.*\n", " - soundfile==0.9.*\n", " - resampy==0.2.*\n", "\n" ] } ], "source": [ "import os\n", "\n", "fn = os.path.join('..', 'environment.yml')\n", "with open(fn, 'r', encoding='utf-8') as stream:\n", " env = stream.read()\n", "\n", "print(env)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Spell Checker\n", "\n", "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):\n", "\n", "```\n", "jupyter contrib nbextension install --user\n", "jupyter nbextension enable spellchecker/main\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Acknowledgment: This notebook was created by Frank Zalkow and Meinard Müller.\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "
\"C0\"\"C1\"\"C2\"\"C3\"\"C4\"\"C5\"\"C6\"\"C7\"\"C8\"
" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.16" } }, "nbformat": 4, "nbformat_minor": 1 }