Python Environments for Spyder and JupyterLab

Package Managers and Distributions

The Python ecosystem is pretty vast and a consequence there are a multitude of ways to install and use Python and a multitude of Integrated Development Environments (IDEs) which are programs used to write Python Code and execute Python Code.

Due to this flexibility, the process of installation often appears fragmented and can become very confusing for a beginner.

Installer Name Package Manager Python Base Environment Python Base Environment Channel Python Version in Base Environment
Mambaforge mamba minimal conda-forge (community channel) 3.10
Anaconda conda data science distribution conda (Anaconda Inc channel) 3.10
Miniconda conda minimal conda (Anaconda Inc channel) 3.10
Miniforge conda minimal conda-forge (community channel) 3.10

Brief Installation Instructions

Brief installation commands below:

Installer

The Mambaforge or Anaconda Installer can be downloaded from here:

In Windows use the installer and use the Mambaforge Prompt or Anaconda Powershell Prompt instead of the Windows Terminal.

In Linux/Mac, it needs to be installed using the Terminal using the shell script file:

cd ~/Downloads
bash Mambaforge-Linux-x86_64.sh

Type q to quit reading the license agreement. Ensure you type yes to initialise Mambaforge/Anaconda. After installation close and reopen the Linux Terminal to refresh it. The prompt should display the Python environment (base) indicating that the Mambafore or Anaconda base Python environment is selected.

Updating the base env

To update the base environment in Mambaforge use:

mamba update --all

Do not attempt to update the Python base environment in Anaconda as it may break the base environment. Wait for the next standalone installer.

Spyder env

To create a new Python environment for the latest version of the Spyder IDE including its optional dependencies for Mambaforge use:

mamba create -n spyder python=3.11 spyder cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy

For Anaconda use:

conda create -n spyder python=3.11 spyder cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy -c conda-forge

To launch Spyder in Mambaforge use:

mamba activate spyder
spyder

To launch Spyder in Anaconda use:

conda activate spyder
spyder

To update the Python environment in Mambaforge use:

mamba activate spyder
mamba update --all

To update the Python environment in Anaconda use:

conda activate spyder
conda update --all -c conda-forge

JupyterLab env

To create a new Python environment for the latest version of the JupyterLab IDE (you may have to specify the latest version number) including its optional dependencies for Mambaforge use:

mamba create -n jupyterlab jupyterlab -c conda-forge
mamba activate jupyterlab 
mamba install ipython cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt
mamba create -n jupyterlab4rc jupyterlab -c "conda-forge/label/jupyterlab_rc"
mamba activate jupyterlab4rc 
mamba install ipython cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt

For Anaconda use:

conda create -n jupyterlab jupyterlab -c conda-forge -c conda-forge
conda activate jupyterlab 
conda install ipython cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt -c conda-forge

To launch JupyterLab in Mambaforge use:

mamba activate jupyterlab
jupyter lab

To launch JupyterLab in Anaconda use:

conda activate jupyterlab
jupyter lab

To update the Python environment in Mambaforge use:

mamba activate jupyterlab
mamba update --all

To update the Python environment in Anaconda use:

conda activate jupyterlab
conda update --all -c conda-forge

VSCode env

To create a new Python environment for the latest version of the Visual Studio Code IDE in Mambaforge use:

mamba create -n vscode python=3.11 notebook cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly ipympl pyqt

In Anaconda, the base Python environment is normally used with Visual Studio Code.

Visual Studio Code needs to be installed separately using the appropriate package for your Operating System.

Once installed, launch Visual Studio Code using the start menu shortcut. Alternatively launch it from the Mambaforge Prompt (Windows)/Terminal (Linux) using:

mamba activate vscode
code

The Python extension should be installed within Visual Studio Code.

The Python Interpretter should be selected. In Visual Studio Code press ctrl, ⇧ and p to open up the command palette. Search for interpretter and select Python: Select Interpretter. Change the interpretter to the vscode Python environment or base Python environment.