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.
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:
Anaconda Prompt
. conda --version
conda update conda
base
conda create --name FMP python=3 numpy scipy matplotlib jupyter
numpy
, scipy
, matplotlib
, and jupyter
conda env list
conda activate FMP
python --version
conda list
conda env remove --name FMP
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:
import os
fn = os.path.join('..', 'environment.yml')
with open(fn, 'r', encoding='utf-8') as stream:
env = stream.read()
print(env)
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