Installing Mambaforge or Anaconda on Linux

This guide will look at the installation of Mambaforge or Anaconda on Linux. Instructions should be identical for Mac.

For Windows see:

System Requirements

The PC should match or exceed the following system requirements:

  • Modern Linux Distribution e.g. Fedora 38, Ubuntu 23.04 or Mac OS X
  • 6th Generation Intel i5 Processor or Later
  • 8 GB RAM or Superior
  • 250 GB SSD or Superior
  • Chromium or Google Chrome Browser

The performance for Python will be poor if these system requirements are not satisfied.

Video

Uninstalling and Purging Old Python Installations

Previous versions of Python Distributions should be uninstalled. For more details see:

Skip uninstallation if already on a clean install of Linux.

Bash and Python Terminals

Press Ctrl, Alt and t to open the Linux Terminal. The Linux Terminal looks like the following and uses the Programming Language bash:

To run a commmand as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

philip@pc:~$

To the bottom is the prompt:

  • user name: philip
  • pc name: pc
  • file path: ~ where ~ is the Home folder in Linux

A command can be input after the prompt $

When copying any line of code from this guide into your Linux Terminal do not include the prompt. i.e. copy to the right hand side of the $ sign.

There is a version of Python preinstalled in the Operating System which can be accessed from the Linux Terminal using:

To run a commmand as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

philip@pc:~$ python

Details about the Python installation will be given:

To run a commmand as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

philip@pc:~$ python
Python 3.11.2 (main, Feb 8 2023, 00:00:00) [GCC 13.0.1 20230208 (Red Hat 13.0.1-0)] on linux on linux

The Python Prompt will display and looks like the following.

>>>

For clarity, the syntax highlighting scheme in this guide will use dark for bash and light for Python making the changes more obvious. Python code can be input:

>>> var = 'Hello World!'
>>> print(var)
Hello World!
>>>

To exit, the Python prompt, the Python exit function can be used:

>>> exit()

This will return to bash:

philip@pc:~$ 

To exit bash, the exit command can be used:

philip@pc:~$ exit

Notice the slight difference in syntax between the exit command (bash) and exit function (Python) because two different programming languages are used.

Mambaforge vs Anaconda

Python is preinstalled in the Linux Operating System, however this Python environment is part of the operating system and has a limited set of Python packages. Moreover installing packages and making changes to this default Python environment may cause instabilities in the Operating System. For development it is better to install a Python Distribution. There are two choices:

  • Mambaforge
  • Anaconda

Mambaforge has a basic base Python environment, installs packages using the community channel conda-forge by default and uses the mamba package manager which is an improved version of the conda package manager.

Anaconda has a busy base Python environment with a multitude of packages preinstalled such as numpy, pandas, matplotlib, seaborn, spyder and jupyterlab. The packages are from the Anaconda Inc channel conda and uses the conda package manager by default. The packages in the conda channel are not as up to date as those in the conda-forge channel as Anaconda Inc take additional time to test packages with their busy Python base environment. Moreover the number of packages in the conda channel are a subset of those in the conda-forge channel as Anaconda Inc only preinstall the most commonly used packages. Because there are so many packages in the base environment, there are often installation conflicts when attempting to install new packages. It is not recommended to update the Anaconda base environment until a standalone installer is released by Anaconda. To install new packages, a Python environment needs to be created.

Installation

The Installers are available from their perspective websites:

Press Ctrl, Alt and t to open the terminal and input

philip@pc:~$ cd ~/Downloads

This will change the directory to Downloads. Alternatively you can right click some whitespace in the Downloads folder within Nautilus File Explorer and select Open in Terminal. The prompt will now look like the following:

philip@pc:~/Downloads $

Anaconda and Mambaforge are installed using a shell script. Shel scripts are launched using the command bash, followed by the name of the script file (including the .sh file extension).

To install Mambaforge input:

philip@pc:~/Downloads $ bash Mambaforge-Linux-x86_64.sh

Alternatively to install Anaconda input:

philip@pc:~/Downloads $ bash Anaconda3-2023.03-1-Linux-x86_64.sh

Welcome to Mambaforge 23.1.0-1

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>  

Press ↵ to get to the license agreement and then q to quit reading it.

Welcome to Mambaforge 23.1.0-1

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>  

Input yes

Do you accept the license terms? [yes|no]
[no] >>> yes

The install location will be listed. Input ↵

Mambaforge will now be installed into this location:
/home/philip/mambaforge

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/philip/mambaforge] >>> 

You will be asked if you want to run conda init. Input yes and then press ↵

Transaction finished
installation finished.
Do you wish the installer to initialize Mambaforge
by running conda init? [yes|no]
[no] >>> yes

Unfortunately the default is no, so if ↵ is pressed without inputting yes, then the Python distribution will be installed but not initialized meaning it is essentially unusable.

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Mambaforge!
philip@pc:~/Downloads $

Close and reopen any terminals. When the terminal is reopened, notice that it will be prefixed with (base) indicating the base Python environment is selected:

(base) philip@pc:~ $

Exploring the base Python Environment

Navigate to:

~/mambaforge/lib/python3.10
~/anaconda3/lib/python3.10

Notice there are a large number of Python modules, script files ending in .py.

If Python is launched details about the Python distribution will be displayed:

(base) philip@pc:~ $ python
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

And a Python Prompt will display:

>>>

There is a datetime.py and this is imported in Python with the following:

>>> import datetime

There are also some subfolders such as collections. In the subfolders are a number of Python modules. The Python script file called __init__.py and this is the file imported in Python using the name of the folder:

>>> import collections

The modules in this folder or in the subfolders are known as Python standard libraries and are included with Python 3.10 which is preinstalled by Mambaforge and Anaconda.

There is also the site-packages subfolder which is where the third-party Python packages are installed which includes the popular data science libraries:

~/mambaforge/lib/python3.10/site-packages
~/anaconda3/lib/python3.10/site-packages

In both cases there is a conda folder which contains the conda package manager and another folder which contains its version.

Mambaforge will also contain a mamba folder and has 63 items as shown.

The Anaconda distribution will contain a very large number of folders. The most commonly used are numpy, pandas, matplotlib and seaborn and these folders will be listed alongside their versions.

The numpy folder has a __init__.py file and this file is imported when the following is input:

>>> import numpy as np

The matplotlib folder has a __init__.py file and pyplot.py file. This pyplot module of this library is imported when the following is input:

>>> import matplotlib.pyplot as plt

If these two commands are attempted in Mambaforge because these libraries aren't found in the Python (base) environment the following will display:

>>> import numpy as np
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'

Anaconda Navigator

Mambaforge does not have the Anaconda Navigator.

The Anaconda Navigator can be launched using:

(base) philip@pc:~ $ anaconda-navigator

This gives a user interface for launching IDEs such as Spyder and JupyterLab.

The (base) Mambaforge environment is minimal and does not include the IDEs.

The Spyder IDE can be launched from its tile in the Anaconda Navigator or directly using:

(base) philip@pc:~ $ spyder

Ignore prompts to update Spyder as a dependency for the latest version of Spyder is not yet satisfied in the conda channel.

In general, it is not recommended to change anything in the Anaconda base Python environment and instead wait until Anaconda release an updated installer. The Python environment is very busy and attempting to install or update a package results in other packages being removed due to their dependencies not being satisfied, this usually results in an unstable base Python environment.

Although the Anaconda Navigator appears to support a limited number of package upgrades for example the upgrade from Spyder 5.4.1 to 5.4.3. The result is usually problematic and such upgrades should be avoided in the base Python environment:

Although it reports a successful install:

Spyder launches with a dependency error:

To the left, environments can be selected and the base Python environment can be selected:

Installing this package modifies 25 packages and removes 175 packages, reducing the functionality of the base Python environment:

The JupyterLab IDE can be launched from its tile or directly using:

(base) philip@pc:~ $ jupyter lab

Note the space between jupyter and lab, this is the only time a space is used for jupyterlab.

If ran from the Terminal, the following will be displayed. Essentially the Terminal runs a JupyterLab server which displays in the browser.

    To access the server, open this file in a browser:
        file:///home/philip/.local/share/jupyter/runtime/jpserver-5156-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/lab?token=9fbacf43e92d81c265d6802cf859a7d3deef4e3c038854eb
     or http://127.0.0.1:8889/lab?token=9fbacf43e92d81c265d6802cf859a7d3deef4e3c038854eb
[W 2023-05-07 07:41:46.052 LabApp] Could not determine jupyterlab build status without nodejs

The server is instructed to run using an infinite loop. After JupyterLab is closed in the browser, the infinite loop can be exited by pressing Ctrl + c and the Terminal will display Interrupted alongside a new Prompt:

^C[I 2023-05-07 07:42:58.547 ServerApp] interrupted
Serving notebooks from local directory: /home/philip
0 active kernels
Jupyter Server 1.23.4 is running at:
http://localhost:8889/lab?token=9fbacf43e92d81c265d6802cf859a7d3deef4e3c038854eb
 or http://127.0.0.1:8889/lab?token=9fbacf43e92d81c265d6802cf859a7d3deef4e3c038854eb
Shutdown this Jupyter server (y/[n])? y
[C 2023-05-07 07:43:01.217 ServerApp] Shutdown confirmed
[I 2023-05-07 07:43:01.218 ServerApp] Shutting down 4 extensions
[I 2023-05-07 07:43:01.219 ServerApp] Shutting down 0 terminals
(base) philip@pc:~ $ 

Updating the base Python Environment

To update the (base) Python environment in Mambaforge use:

(base) philip@pc:~ $ mamba update --all

Do not update the base environment in Anaconda as it will likely result in an instability. Instead wait for the next updated standalone installer.

The terminal will display:

Looking for: ['_libgcc_mutex', 'ca-certificates', 'ld_impl_linux-64', 'libstdcxx-ng', 'pybind11-abi', 'python_abi', 'tzdata', 'libgomp', '_openmp_mutex', 'libgcc-ng', 'bzip2', 'c-ares', 'fmt', 'icu', 'keyutils', 'libev', 'libffi', 'libiconv', 'libnsl', 'libuuid', 'libzlib', 'lz4-c', 'lzo', 'ncurses', 'openssl', 'reproc', 'xz', 'yaml-cpp', 'libedit', 'libnghttp2', 'libsolv', 'libsqlite', 'libssh2', 'libxml2', 'readline', 'reproc-cpp', 'tk', 'zstd', 'krb5', 'libarchive', 'python', 'certifi', 'charset-normalizer', 'colorama', 'idna', 'libcurl', 'pluggy', 'pycosat', 'pycparser', 'pysocks', 'ruamel.yaml.clib', 'setuptools', 'toolz', 'wheel', 'cffi', 'libmamba', 'pip', 'ruamel.yaml', 'tqdm', 'brotlipy', 'cryptography', 'libmambapy', 'zstandard', 'conda-package-streaming', 'pyopenssl', 'conda-package-handling', 'urllib3', 'requests', 'conda', 'mamba']

conda-forge/noarch                                 @   2.8MB/s  4.8s
conda-forge/linux-64                               @   3.9MB/s 11.0s

Pinned packages:
  - python 3.10.*


Transaction

  Prefix: /home/philip/mambaforge

The transaction gives the location of the Mambaforge environment. You can open this location in nautillus file explorer and view the changes:

~/mambaforge/lib/python3.10/site-packages

Then details about each package being Installed, Changed and Upgraded will be listed. Input y and then press ↵

  Package         Version  Build            Channel                   Size
────────────────────────────────────────────────────────────────────────────
  Install:
────────────────────────────────────────────────────────────────────────────

  + boltons        23.0.0  pyhd8ed1ab_0     conda-forge/noarch       303kB
  + jsonpatch        1.32  pyhd8ed1ab_0     conda-forge/noarch        15kB
  + jsonpointer       2.0  py_0             conda-forge/noarch         9kB
  + packaging        23.1  pyhd8ed1ab_0     conda-forge/noarch        46kB

  Change:
────────────────────────────────────────────────────────────────────────────

  - libsqlite      3.40.0  h753d276_0       conda-forge                   
  + libsqlite      3.40.0  h753d276_1       conda-forge/linux-64     804kB
  - openssl         3.1.0  h0b41bf4_0       conda-forge                   
  + openssl         3.1.0  hd590300_3       conda-forge/linux-64       3MB

  Upgrade:
────────────────────────────────────────────────────────────────────────────

  - conda          23.1.0  py310hff52083_0  conda-forge                   
  + conda          23.3.1  py310hff52083_0  conda-forge/linux-64     964kB
  - cryptography   40.0.1  py310h34c0648_0  conda-forge                   
  + cryptography   40.0.2  py310h34c0648_0  conda-forge/linux-64       2MB
  - libcurl        7.88.1  hdc1c0ab_1       conda-forge                   
  + libcurl         8.0.1  h588be90_0       conda-forge/linux-64     361kB
  - libmamba        1.4.1  hcea66bb_0       conda-forge                   
  + libmamba        1.4.2  hcea66bb_0       conda-forge/linux-64       1MB
  - libmambapy      1.4.1  py310h1428755_0  conda-forge                   
  + libmambapy      1.4.2  py310h1428755_0  conda-forge/linux-64     270kB
  - libxml2        2.10.3  hfdac1af_6       conda-forge                   
  + libxml2        2.10.4  hfdac1af_0       conda-forge/linux-64     714kB
  - mamba           1.4.1  py310h51d5547_0  conda-forge                   
  + mamba           1.4.2  py310h51d5547_0  conda-forge/linux-64      51kB
  - pip            23.0.1  pyhd8ed1ab_0     conda-forge                   
  + pip            23.1.2  pyhd8ed1ab_0     conda-forge/noarch         1MB
  - requests       2.28.2  pyhd8ed1ab_1     conda-forge                   
  + requests       2.29.0  pyhd8ed1ab_0     conda-forge/noarch        57kB
  - ruamel.yaml   0.17.21  py310h1fa729e_3  conda-forge                   
  + ruamel.yaml   0.17.22  py310h2372a71_0  conda-forge/linux-64     197kB
  - setuptools     65.6.3  pyhd8ed1ab_0     conda-forge                   
  + setuptools     67.7.2  pyhd8ed1ab_0     conda-forge/noarch       583kB

  Summary:

  Install: 4 packages
  Change: 2 packages
  Upgrade: 11 packages

  Total download: 11MB

────────────────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] y

The packages will then download and install, when finished a new prompt will display:

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) philip@pc:~ $

The changes will also be reflected in Nautillus file explorer.

Package Manager

Mambaforge has the package manager mamba which is based upon the conda package manager. Both are command line based and the syntax is similar as one is base on the other.

In Mambaforge input:

(base) philip@pc:~ $ mamba

In Anconda input:

(base) philip@pc:~ $ conda

This will display a summary of the package manager:

usage: mamba [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean             Remove unused packages and caches.
    compare           Compare packages between conda environments.
    config            Modify configuration values in .condarc. This is modeled
                      after the git config command. Writes to the user
                      .condarc file (/home/philip/.condarc) by default. Use
                      the --show-sources flag to display all identified
                      configuration locations on your computer.
    create            Create a new conda environment from a list of specified
                      packages.
    info              Display information about current conda install.
    init              Initialize conda for shell interaction.
    install           Installs a list of packages into a specified conda
                      environment.
    list              List installed packages in a conda environment.
    package           Low-level conda package utility. (EXPERIMENTAL)
    remove (uninstall)
                      Remove a list of packages from a specified conda
                      environment. Use `--all` flag to remove all packages and
                      the environment itself.
    rename            Renames an existing environment.
    run               Run an executable in a conda environment.
    search            Search for packages and display associated
                      information.The input is a MatchSpec, a query language
                      for conda packages. See examples below.
    update (upgrade)  Updates conda packages to the latest compatible version.
    notices           Retrieves latest channel notifications.
    repoquery         Query repositories using mamba.

options:
  -h, --help          Show this help message and exit.
  -V, --version       Show the conda version number and exit.

conda commands available from other packages (legacy):
  env
(base) philip@pc:~ $ 

The most import subcommands are:

  • list
  • search
  • create
  • activate
  • install
  • update
  • clean
  • remove
  • env

list

To list the packages installed in the currently selected Python environment in Mambaforge input:

(base) philip@pc:~ $ mamba list

In Anaconda input:

(base) philip@pc:~ $ conda list

The output will be shown:

# packages in environment at /home/philip/mambaforge:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
boltons                   23.0.0             pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.3.1          py310hff52083_0    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge
cryptography              40.0.2          py310h34c0648_0    conda-forge
fmt                       9.1.0                h924138e_0    conda-forge
icu                       72.1                 hcb278e6_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
jsonpatch                 1.32               pyhd8ed1ab_0    conda-forge
jsonpointer               2.0                        py_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libarchive                3.6.2                h3d51595_0    conda-forge
libcurl                   8.0.1                h588be90_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libmamba                  1.4.2                hcea66bb_0    conda-forge
libmambapy                1.4.2           py310h1428755_0    conda-forge
libnghttp2                1.52.0               h61bc06f_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libsolv                   0.7.23               h3eb15da_0    conda-forge
libsqlite                 3.40.0               h753d276_1    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxml2                   2.10.4               hfdac1af_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mamba                     1.4.2           py310h51d5547_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
openssl                   3.1.0                hd590300_3    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
pip                       23.1.2             pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py310h5764c6d_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.1.1             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.10         he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
readline                  8.2                  h8228510_1    conda-forge
reproc                    14.2.4               h0b41bf4_0    conda-forge
reproc-cpp                14.2.4               hcb278e6_0    conda-forge
requests                  2.29.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.17.22         py310h2372a71_0    conda-forge
ruamel.yaml.clib          0.2.7           py310h1fa729e_1    conda-forge
setuptools                67.7.2             pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
urllib3                   1.26.15            pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml-cpp                  0.7.0                h27087fc_2    conda-forge
zstandard                 0.19.0          py310hdeb6495_1    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge
(base) philip@pc:~ $ 

Python packages use the version number a.i.p where a is the major version, i is the minor version and p is the patch version.

To search for a package for example spyder. In Mambaforge use:

(base) philip@pc:~ $ mamba search spyder

In Anaconda input:

(base) philip@pc:~ $ conda search spyder

The output in Mambaforge will be:

Loading channels: done
# Name                       Version           Build  Channel  
spyder                         5.4.2 py310hff52083_0  conda-forge         
spyder                         5.4.2 py311h38be061_0  conda-forge         
spyder                         5.4.2  py38h578d9bd_0  conda-forge         
spyder                         5.4.2  py39hf3d152e_0  conda-forge         
spyder                         5.4.3 py310hff52083_0  conda-forge         
spyder                         5.4.3 py311h38be061_0  conda-forge         
spyder                         5.4.3  py38h578d9bd_0  conda-forge         
spyder                         5.4.3  py39hf3d152e_0  conda-forge     
(base) philip@pc:~ $ 

In Anaconda will be:

Loading channels: done
# Name                       Version           Build  Channel  
spyder                         5.4.2 py310hff52083_0  conda        
spyder                         5.4.2 py311h38be061_0  conda        
spyder                         5.4.2  py38h578d9bd_0  conda        
spyder                         5.4.2  py39hf3d152e_0  conda            
(base) philip@pc:~ $ 

Notice the versions are ordered and the newest version is at the bottom. A package may also be available for different Python versions. For example the latest version of Spyder is listed for Python 3.8, 3.9, 3.10 and 3.11. Currently Python Version 3.10 is the default version of Anaconda and Mambaforge.

Notice the difference in channels; Mambaforge uses the community channel conda-forge by default and Anaconda use the Anaconda Inc channel conda by default. The latest version in the conda channel is often behind the latest version in the community channel conda-forge as Anaconda Inc take some additional time for testing.

It is possible to specify the channel in Anaconda using the channel parameter:

(base) philip@pc:~ $ conda search spyder -c conda-forge

This will give the same output as Mambaforge:

Loading channels: done
# Name                       Version           Build  Channel  
spyder                         5.4.2 py310hff52083_0  conda-forge         
spyder                         5.4.2 py311h38be061_0  conda-forge         
spyder                         5.4.2  py38h578d9bd_0  conda-forge         
spyder                         5.4.2  py39hf3d152e_0  conda-forge         
spyder                         5.4.3 py310hff52083_0  conda-forge         
spyder                         5.4.3 py311h38be061_0  conda-forge         
spyder                         5.4.3  py38h578d9bd_0  conda-forge         
spyder                         5.4.3  py39hf3d152e_0  conda-forge     
(base) philip@pc:~ $ 

create

A Python environment is a subinstallation of Python which you can use to install a different version of Python and an assortment of Python packages without touching your base Python environment (default). Python environments are stored in the envs subfolder:

~/mambaforge/envs
~/anaconda3/envs

A Python environment with the name spyder will be created for the latest version of the Spyder IDE.

In Mambaforge use:

(base) philip@pc:~ $ mamba create -n spyder

In Anaconda use:

(base) philip@pc:~ $ conda create -n spyder

The Python environment will be created:

Looking for: []

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

     $ mamba activate spyder

To deactivate an active environment, use

     $ mamba deactivate

(base) philip@pc:~ $

The spyder subfolder will appear:

~/mambaforge/envs/spyder
~/anaconda3/envs/spyder

This folder will be empty until packages have been added to it.

activate

The prompt has the prefix base which means the base Python environment is selected and therefore any commands like list, install, remove, update will look at or make changes to the base Python environment:

(base) philip@pc:~ $

To switch Python environment. In Mambaforge use:

(base) philip@pc:~ $ mamba activate spyder

In Anaconda use:

(base) philip@pc:~ $ conda activate spyder

Notice that the (base) now changes to (spyder) indicating the spyder Python environment is selected:

(spyder) philip@pc:~ $ 

Notice that the (base) now changes to (spyder) indicating the spyder Python environment is selected. Now any commands like list, install, remove, update will look at or make changes to the base Python environment. For example if list is used:

(spyder) philip@pc:~ $ mamba list

An empty list displays because nothing has been added to the Python environment:

(spyder) philip@pc:~ $ mamba list
# packages in environment at /home/philip/mambaforge/envs/spyder:
#
# Name                    Version                   Build  Channel

The Python environment will be activated only for that terminal session. If the terminal is closed and relaunched, the (base) Python environment which is the default will be reselected. The spyder environment will need to be activated again to work with it.

install

In Mambaforge it is recommended to install new packages in a separate Python environment.

To install a package in Mambaforge use the syntax:

(base) philip@pc:~ $ mamba install spyder

Multiple packages can be installed simultaneously:

(base) philip@pc:~ $ mamba install python spyder

The version number of the package can be assigned, for example to create a Python environment with Python 3.11 instead of the default Python 3.10 use:

(base) philip@pc:~ $ mamba install python=3.11 spyder

In Anaconda it is mandatory to install new packages in a separate Python environment. Installation of packages, particularly a package corresponding to an IDE such as Spyder which has a large number of dependencies will conflict with the dependencies for other packages in the base Python environment, normally resulting in numerous changes and most packages being removed, leaving the base environment in an unusable state.

Generally additional Python environments are made using packages from the community channel conda-forge. Python environments using mixed channels conda and conda-forge are unstable.

To install a package in Anaconda from the community channel conda-forge use the syntax:

(base) philip@pc:~ $ conda install spyder -c conda-forge

Multiple packages can be installed simultaneously:

(base) philip@pc:~ $ conda install python spyder -c conda-forge

The version number of the package can be assigned:

(base) philip@pc:~ $ conda install python=3.11 spyder -c conda-forge

To install Spyder and all its dependencies for Python 3.11. For Mambaforge use:

(spyder) philip@pc:~ $ mamba install spyder python=3.11 cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy

For Anaconda use:

(spyder) philip@pc:~ $ conda install spyder python=3.11 cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy -c conda-forge

Because each of these libraries have a large number of dependencies the following will display. The full list of ~300 packages and their details will display. Input y to proceed:

Looking for: ['spyder', 'python=3.11', 'cython', 'seaborn', 'scikit-learn', 'sympy', 'openpyxl', 'xlrd', 'xlsxwriter', 'lxml', 'sqlalchemy']

Transaction

  Prefix: /home/philip/mambaforge/envs/spyder

  Updating specs:

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


  Package                               Version  Build                Channel                    Size
───────────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────────────────────────────────

  + ipykernel                            6.22.0  pyh210e3f2_0         conda-forge/noarch        112kB
  + ipython                              8.13.2  pyh41d4057_0         conda-forge/noarch        583kB

  + matplotlib-base                       3.7.1  py311h8597a09_0      conda-forge/linux-64        8MB
  + matplotlib-inline                     0.1.6  pyhd8ed1ab_0         conda-forge/noarch         12kB

  + numpy                                1.24.3  py311h64a7726_0      conda-forge/linux-64        8MB

  + pandas                                2.0.1  py311h320fe9a_0      conda-forge/linux-64       15MB

  + python                               3.11.3  h2755cc3_0_cpython   conda-forge/linux-64       31MB

  + qt-main                              5.15.8  h5c52f38_9           conda-forge/linux-64       53MB

  + scikit-learn                          1.2.2  py311h103fc68_1      conda-forge/linux-64        9MB
  + scipy                                1.10.1  py311h8e6699e_0      conda-forge/linux-64       26MB

  + seaborn                              0.12.2  hd8ed1ab_0           conda-forge/noarch          6kB
  + seaborn-base                         0.12.2  pyhd8ed1ab_0         conda-forge/noarch        232kB

  + spyder                                5.4.3  py311h38be061_0      conda-forge/linux-64       12MB
  + spyder-kernels                        2.4.3  unix_pyhd8ed1ab_0    conda-forge/noarch         80kB



  Summary:

  Install: 331 packages

  Total download: 500MB

───────────────────────────────────────────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] y

When the packages have finished downloading and installing, the following will display:

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(spyder) philip@pc:~ $ 

Now there will be the following folder:

~/mambaforge/envs/spyder/lib/python3.11
~/anaconda3/envs/spyder/lib/python3.11

Exploring the spyder Python Environment

If Anaconda is install, the Anaconda Navigator can be launched from the base Python environment. In the environments tab, the spyder Python environment can be selected:

In the Home Tab, installed applications can be selected for the spyder Python environment:

In this folder will be Python 3.11 and the Python standard libraries. If the following is input:

(spyder) philip@pc:~ $ python

Details about the installed Python version will display:

(spyder) philip@pc:~ $ python
Python 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:57:19) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

The Python prompt will then display:

>>>

The standard library datetime.py can be imported using:

>>> import datetime

There is a subfolder called collections and in that folder there is an __init__.py file, this is the file that is imported when collections is imported using:

>>> import collections

The modules in this folder or in the subfolders are known as Python standard libraries and are included with Python 3.11 itself.

There is also the site-packages subfolder which is where the third-party Python packages are installed which includes the popular data science libraries:

~/mambaforge/envs/spyder/lib/python3.11/site-packages
~/anaconda3/envs/spyder/lib/python3.11/site-packages

The numpy folder has a __init__.py file and this file is imported when the following is input:

>>> import numpy as np

The matplotlib folder has a __init__.py file and pyplot.py file. This pyplot module of this library is imported when the following is input:

>>> import matplotlib.pyplot as plt

To exit the Python prompt type in:

>>> exit()

The bash prompt will return:

(spyder) philip@pc:~ $ 

To launch the Spyder IDE input:

(spyder) philip@pc:~ $ spyder

A QT warning may display which can be ignored:

(spyder) philip@pc:~ $ spyder
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
fromIccProfile: failed minimal tag size sanity

Spyder is a process that is running from the terminal and the terminal window will be unusable while Spyder is running. Another terminal window can be opened for another task. The Spyder IDE displays:

update

To update the Python environment. In Mambaforge use the command:

(spyder) philip@pc:~ $ mamba update --all

In Anaconda use the command:

(spyder) philip@pc:~ $ conda update --all -c conda-forge

Do not use this command with base Python environment in Anaconda.

If there are updates proposed changes will be displayed, these can be reviewed and accepted by inputting y.

  Package  Version  Build         Channel                 Size
────────────────────────────────────────────────────────────────
  Upgrade:
────────────────────────────────────────────────────────────────

  - rope     1.7.0  pyhd8ed1ab_0  conda-forge                 
  + rope     1.8.0  pyhd8ed1ab_0  conda-forge/noarch     148kB

  Summary:

  Upgrade: 1 packages

  Total download: 148kB

────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] y

Otherwise if all packages are up to date, All requested packages already installed will display.

Looking for: ['_libgcc_mutex', 'ca-certificates', 'font-ttf-dejavu-sans-mono', 'font-ttf-inconsolata', 'font-ttf-source-code-pro', 'font-ttf-ubuntu', 'ld_impl_linux-64', 'libgfortran5', 'libstdcxx-ng', 'python_abi', 'tzdata', 'fonts-conda-forge', 'libgfortran-ng', 'libgomp', '_openmp_mutex', 'fonts-conda-ecosystem', 'libgcc-ng', 'alsa-lib', 'attr', 'bzip2', 'fftw', 'gettext', 'giflib', 'gmp', 'graphite2', 'gstreamer-orc', 'icu', 'keyutils', 'lame', 'lerc', 'libbrotlicommon', 'libdb', 'libdeflate', 'libexpat', 'libffi', 'libiconv', 'libjpeg-turbo', 'libnsl', 'libogg', 'libopenblas', 'libopus', 'libsodium', 'libspatialindex', 'libtool', 'libuuid', 'libwebp-base', 'libzlib', 'lz4-c', 'mpg123', 'ncurses', 'nspr', 'openssl', 'pixman', 'pthread-stubs', 'xkeyboard-config', 'xorg-kbproto', 'xorg-libice', 'xorg-libxau', 'xorg-libxdmcp', 'xorg-renderproto', 'xorg-xextproto', 'xorg-xf86vidmodeproto', 'xorg-xproto', 'xz', 'yaml', 'expat', 'jack', 'libblas', 'libbrotlidec', 'libbrotlienc', 'libcap', 'libedit', 'libevent', 'libflac', 'libgpg-error', 'libpng', 'libsqlite', 'libvorbis', 'libxcb', 'libxml2', 'mpfr', 'mysql-common', 'pandoc', 'pcre2', 'readline', 'tk', 'xorg-libsm', 'zeromq', 'zlib', 'zstd', 'brotli-bin', 'freetype', 'krb5', 'libcblas', 'libgcrypt', 'libglib', 'liblapack', 'libllvm16', 'libsndfile', 'libtiff', 'libudev1', 'libxkbcommon', 'libxslt', 'mpc', 'mysql-libs', 'nss', 'python', 'xcb-util', 'xcb-util-keysyms', 'xcb-util-renderutil', 'xcb-util-wm', 'xorg-libx11', 'alabaster', 'atomicwrites', 'attrs', 'backcall', 'backports', 'brotli', 'certifi', 'chardet', 'charset-normalizer', 'click', 'cloudpickle', 'colorama', 'cycler', 'cython', 'dbus', 'debugpy', 'decorator', 'defusedxml', 'diff-match-patch', 'dill', 'docstring-to-markdown', 'docutils', 'entrypoints', 'et_xmlfile', 'executing', 'fontconfig', 'glib-tools', 'gmpy2', 'greenlet', 'idna', 'imagesize', 'inflection', 'ipython_genutils', 'jeepney', 'jellyfish', 'kiwisolver', 'lazy-object-proxy', 'lcms2', 'libclang13', 'libcups', 'libpq', 'libsystemd0', 'libwebp', 'lxml', 'markupsafe', 'mccabe', 'mistune', 'more-itertools', 'mpmath', 'munkres', 'mypy_extensions', 'nest-asyncio', 'numpy', 'openjpeg', 'packaging', 'pandocfilters', 'parso', 'pathspec', 'pickleshare', 'pkgutil-resolve-name', 'pluggy', 'ply', 'psutil', 'ptyprocess', 'pure_eval', 'pycodestyle', 'pycparser', 'pyflakes', 'pygments', 'pylint-venv', 'pyparsing', 'pyrsistent', 'pysocks', 'python-fastjsonschema', 'python-tzdata', 'pytz', 'pyxdg', 'pyyaml', 'pyzmq', 'rtree', 'setuptools', 'six', 'snowballstemmer', 'sortedcontainers', 'soupsieve', 'sphinxcontrib-applehelp', 'sphinxcontrib-devhelp', 'sphinxcontrib-htmlhelp', 'sphinxcontrib-jsmath', 'sphinxcontrib-qthelp', 'sphinxcontrib-serializinghtml', 'text-unidecode', 'textdistance', 'threadpoolctl', 'toml', 'tomli', 'tomlkit', 'tornado', 'traitlets', 'typing_extensions', 'ujson', 'unidecode', 'webencodings', 'whatthepatch', 'wheel', 'wrapt', 'wurlitzer', 'xcb-util-image', 'xlrd', 'xlsxwriter', 'xorg-libxext', 'xorg-libxrender', 'yapf', 'zipp', 'astroid', 'asttokens', 'autopep8', 'babel', 'backports.functools_lru_cache', 'beautifulsoup4', 'binaryornot', 'bleach', 'cairo', 'cffi', 'comm', 'contourpy', 'flake8', 'fonttools', 'glib', 'importlib-metadata', 'importlib_resources', 'intervaltree', 'isort', 'jaraco.classes', 'jedi', 'jinja2', 'joblib', 'jupyterlab_pygments', 'libclang', 'matplotlib-inline', 'openpyxl', 'pexpect', 'pillow', 'pip', 'pulseaudio-client', 'pydocstyle', 'python-dateutil', 'python-lsp-jsonrpc', 'python-slugify', 'qtpy', 'sip', 'sympy', 'three-merge', 'tinycss2', 'typing-extensions', 'watchdog', 'arrow', 'brotlipy', 'cryptography', 'gstreamer', 'harfbuzz', 'importlib_metadata', 'jsonschema', 'matplotlib-base', 'pandas', 'platformdirs', 'pulseaudio-daemon', 'pyqt5-sip', 'python-lsp-server-base', 'pytoolconfig', 'qdarkstyle', 'qstylizer', 'qtawesome', 'sqlalchemy', 'stack_data', 'wcwidth', 'black', 'gst-plugins-base', 'jinja2-time', 'jupyter_core', 'prompt-toolkit', 'pulseaudio', 'pylint', 'pyopenssl', 'rope', 'secretstorage', 'jupyter_client', 'keyring', 'nbformat', 'prompt_toolkit', 'python-lsp-server', 'qt-main', 'urllib3', 'ipython', 'nbclient', 'pyls-spyder', 'pyqt', 'python-lsp-black', 'qt-webengine', 'requests', 'cookiecutter', 'ipykernel', 'nbconvert-core', 'pooch', 'pyqtwebengine', 'sphinx', 'nbconvert-pandoc', 'numpydoc', 'qtconsole-base', 'scipy', 'spyder-kernels', 'nbconvert', 'patsy', 'qtconsole', 'scikit-learn', 'seaborn-base', 'spyder', 'statsmodels', 'seaborn']

Pinned packages:
  - python 3.11.*


Transaction

  Prefix: /home/philip/mambaforge/envs/spyder

  All requested packages already installed

(spyder) philip@pc:~ $

It is recommended to periodically check for updates for a Python environment.

clean

The conda and mamba package managers cache packages, meaning the packages are downloaded as tarball files. If a tarball file has already been downloaded for a previously created Python environment it will be reused instead of redownloading the tarball again making installation faster. The tarball files from previous versions of Python libraries do not get deleted by default, which makes it easy to revert back to a previous version without redownloading any files. When the Python environment is frequently updated, there will be a large number of older versions of tarball files. These can be removed in Mambaforge using the command:

(spyder) philip@pc:~ $ mamba clean -all

In Anaconda instead use the command:

(spyder) philip@pc:~ $ conda clean -all

The following output will display, input y at each question in order to proceed with the clean up:

Will remove 377 (555.1 MB) tarball(s).
Proceed ([y]/n)? y
Will remove 1 index cache(s).
Proceed ([y]/n)? y
Will remove 38 (53.5 MB) package(s).
Proceed ([y]/n)? y
There are no tempfile(s) to remove.
There are no logfile(s) to remove.
(spyder) philip@pc:~ $

revision

The revisions for a Python environment can be listed in Mambaforge using:

(spyder) philip@pc:~ $ mamba list --revision

Or in Anaconda using:

(spyder) philip@pc:~ $ conda list --revision

The revisions will be listed. For each revision the packages added and the packages removed will be displayed:

(spyder) philip@pc:~ $ mamba list --revision
2023-05-05 07:02:20  (rev 0)

2023-05-05 07:26:45  (rev 1)

    +ipykernel-6.22.0 (conda-forge/noarch)
    +ipython-8.13.2 (conda-forge/noarch)
    +ipython_genutils-0.2.0 (conda-forge/noarch)

    +matplotlib-base-3.7.1 (conda-forge/linux-64)
    +matplotlib-inline-0.1.6 (conda-forge/noarch)

    +numpy-1.24.3 (conda-forge/linux-64)

    +pandas-2.0.1 (conda-forge/linux-64)

    +pyqt-5.15.7 (conda-forge/linux-64)
    +pyqt5-sip-12.11.0 (conda-forge/linux-64)

    +python-3.11.3 (conda-forge/linux-64)
    +python-dateutil-2.8.2 (conda-forge/noarch)

    +qt-main-5.15.8 (conda-forge/linux-64)
    +qt-webengine-5.15.8 (conda-forge/linux-64)

    +rope-1.7.0 (conda-forge/noarch)

    +scikit-learn-1.2.2 (conda-forge/linux-64)
    +scipy-1.10.1 (conda-forge/linux-64)
    +seaborn-0.12.2 (conda-forge/noarch)
    +seaborn-base-0.12.2 (conda-forge/noarch)

    +spyder-5.4.3 (conda-forge/linux-64)
    +spyder-kernels-2.4.3 (conda-forge/noarch)


2023-05-05 08:25:44  (rev 2)
     rope  {1.7.0 (conda-forge/noarch) -> 1.8.0 (conda-forge/noarch)}

A revision can be restored in Mambaforge using:

(spyder) philip@pc:~ $ mamba install --revision 1

Or in Anaconda using:

(spyder) philip@pc:~ $ mamba install --revision 1

In my case for Mambaforge, it doesn't seem to work properly and no changes are made.

Looking for: []

conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache

Pinned packages:
  - python 3.11.*


Transaction

  Prefix: /home/philip/mambaforge/envs/spyder

  All requested packages already installed

(spyder) philip@pc:~ $ 

It is more reliable to periodically export Python environment yxml files and import these to revert to a Python environment which is discussed below.

remove

A package can be removed (uninstalled) in Mambaforge using:

(spyder) philip@pc:~ $ mamba remove spyder

Or in Anaconda using:

(spyder) philip@pc:~ $ conda remove spyder -c conda-forge

The following output will display. Note removing a package that other packages are dependent on will also remove those packages. Not selecting the correct channel conda-forge may result in packages being replaced by packages in the higher priority conda channel. Review the changes and input y in order to proceed:

Removing specs: ['spyder']
Transaction

  Prefix: /home/philip/mambaforge/envs/spyder

  Removing specs:

   - spyder


  Package   Version  Build            Channel         Size
────────────────────────────────────────────────────────────
  Remove:
────────────────────────────────────────────────────────────

  - spyder    5.4.3  py311h38be061_0  conda-forge         

  Summary:

  Remove: 1 packages

  Total download: 0 B

────────────────────────────────────────────────────────────


Confirm changes: [Y/n] y

The package spyder is now removed:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(spyder) philip@pc:~ $ 

Attempting to launch Spyder now will give an error:

(spyder) philip@pc:~ $ spyder
(spyder) philip@pc:~ $ spyder
bash: spyder: command not found...
Install package 'python3-spyder' to provide command 'spyder'? [N/y] n

env

The env command can be used to list and remove Python environments. To list the Python environments in Mambaforge use:

(spyder) philip@pc:~ $ mamba env list

To list the Python environments in Anaconda use:

(spyder) philip@pc:~ $ conda env list

The following will be output:

(spyder) philip@pc:~ $ mamba env list
# conda environments:
#
base                     /home/philip/mambaforge
spyder                *  /home/philip/mambaforge/envs/spyder

The * indicates the Python environment selected.

To remove a Python environment, it cannot be activated. Therefore to remove the spyder Python environment, base will first be activated. To remove the spyder Python environment in Mambaforge use:

(spyder) philip@pc:~ $ mamba activate base
(base) philip@pc:~ $ mamba env remove -n spyder

In Anaconda use:

(spyder) philip@pc:~ $ conda activate base
(base) philip@pc:~ $ conda env remove -n spyder

The following will display:

Remove all packages in environment /home/philip/mambaforge/envs/spyder:

(base) philip@pc:~ $ 

The spyder folder in:

~/mambaforge/envs
~/anaconda3/envs

will now be removed.

Python Environments for IDEs

The create and install commands can be combined, which will create a Python environment with packages installed in revision 0.

spyder – Mambaforge

A Python environment for Spyder can be created on Mambaforge using the following steps:

Create:

(base) philip@pc:~ $ mamba create -n spyder python=3.11 spyder cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy

Update:

(base) philip@pc:~ $ mamba activate spyder
(spyder) philip@pc:~ $ mamba update --all

Launch:

(base) philip@pc:~ $ mamba activate spyder
(spyder) philip@pc:~ $ spyder

spyder – Anaconda

A Python environment for Spyder can be created on Anaconda using the following steps:

Create:

(base) philip@pc:~ $ conda create -n spyder python=3.11 spyder cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy -c conda-forge

Update:

(base) philip@pc:~ $ conda activate spyder
(spyder) philip@pc:~ $ conda update --all -c conda-forge

Launch:

(base) philip@pc:~ $ conda activate spyder
(spyder) philip@pc:~ $ spyder

jupyterlab – mambaforge

A Python environment for JupyterLab can be created on Mambaforge using the following steps:

Create:

(base) philip@pc:~ $ mamba create -n jupyterlab jupyterlab
(base) philip@pc:~ $ mamba activate jupyterlab
(jupyterlab) philip@pc:~ $ mamba install cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt
(base) philip@pc:~ $ mamba create -n jupyterlab4rc jupyterlab -c "conda-forge/label/jupyterlab_rc"
(base) philip@pc:~ $ mamba activate jupyterlab4rc
(jupyterlab4rc) philip@pc:~ $ mamba install cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt

Update:

(base) philip@pc:~ $ mamba activate jupyterlab
(jupyterlab) philip@pc:~ $ mamba update --all

Launch:

(base) philip@pc:~ $ mamba activate jupyterlab
(jupyterlab) philip@pc:~ $ jupyter lab

jupyterlab – Anaconda

A Python environment for JupyterLab can be created on Anaconda using the following steps:

Create:

(base) philip@pc:~ $ conda create -n jupyterlab jupyterlab -c conda-forge
(base) philip@pc:~ $ conda activate jupyterlab
(jupyterlab) philip@pc:~ $ conda install cython seaborn scikit-learn sympy openpyxl xlrd xlsxwriter lxml sqlalchemy nodejs ipywidgets plotly jupyterlab-variableinspector ipympl pyqt -c conda-forge

Note specifying a Python version to install alongside JupyterLab will install an older version of JupyterLab as Anaconda rerelease JupyterLab for different Python versions. Specifying to install JupyterLab only when creating the Python environment will install the latest version of JupyterLab with Python 3.11. The Python environment can be activated so other optional dependencies can be installed.

Update:

(base) philip@pc:~ $ conda activate jupyterlab
(jupyterlab) philip@pc:~ $ conda update --all -c conda-forge

Launch:

(base) philip@pc:~ $ conda activate jupyterlab
(jupyterlab) philip@pc:~ $ jupyter lab

Exporting an Environment to a yml file

A Python environment can be exported to a Yet another Markdown Language File in Mambaforge using:

(base) philip@pc:~ $ mamba activate spyder
(spyder) philip@pc:~ $ mamba env export > ~/Documents/spyder.yml

Or Anaconda using:

(base) philip@pc:~ $ conda activate spyder
(spyder) philip@pc:~ $ conda env export > ~/Documents/spyder.yml

The file is saved in Documents:

~/Documents

The spyder.yml looks like the following:

name: spyder
channels:
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - alabaster=0.7.13=pyhd8ed1ab_0
  - alsa-lib=1.2.8=h166bdaf_0
  - arrow=1.2.3=pyhd8ed1ab_0
  - astroid=2.15.4=py311h38be061_0
  - asttokens=2.2.1=pyhd8ed1ab_0
  - atomicwrites=1.4.1=pyhd8ed1ab_0
  - attr=2.5.1=h166bdaf_1
  - attrs=23.1.0=pyh71513ae_0
  - autopep8=2.0.2=pyhd8ed1ab_0
  - babel=2.12.1=pyhd8ed1ab_1
  - backcall=0.2.0=pyh9f0ad1d_0
  - backports=1.0=pyhd8ed1ab_3
  - backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
  - beautifulsoup4=4.12.2=pyha770c72_0
  - binaryornot=0.4.4=py_1
  - black=23.3.0=py311h38be061_1
  - bleach=6.0.0=pyhd8ed1ab_0
  - brotli=1.0.9=h166bdaf_8
  - brotli-bin=1.0.9=h166bdaf_8
  - brotlipy=0.7.0=py311hd4cff14_1005
  - bzip2=1.0.8=h7f98852_4
  - ca-certificates=2022.12.7=ha878542_0
  - cairo=1.16.0=h35add3b_1015
  - certifi=2022.12.7=pyhd8ed1ab_0
  - cffi=1.15.1=py311h409f033_3
  - chardet=5.1.0=py311h38be061_0
  - charset-normalizer=3.1.0=pyhd8ed1ab_0
  - click=8.1.3=unix_pyhd8ed1ab_2
  - cloudpickle=2.2.1=pyhd8ed1ab_0
  - colorama=0.4.6=pyhd8ed1ab_0
  - comm=0.1.3=pyhd8ed1ab_0
  - contourpy=1.0.7=py311ha3edf6b_0
  - cookiecutter=2.1.1=pyh6c4a22f_0
  - cryptography=40.0.2=py311h9b4c7bb_0
  - cycler=0.11.0=pyhd8ed1ab_0
  - cython=0.29.34=py311hcafe171_0
  - dbus=1.13.6=h5008d03_3
  - debugpy=1.6.7=py311hcafe171_0
  - decorator=5.1.1=pyhd8ed1ab_0
  - defusedxml=0.7.1=pyhd8ed1ab_0
  - diff-match-patch=20200713=pyh9f0ad1d_0
  - dill=0.3.6=pyhd8ed1ab_1
  - docstring-to-markdown=0.12=pyhd8ed1ab_0
  - docutils=0.19=py311h38be061_1
  - entrypoints=0.4=pyhd8ed1ab_0
  - et_xmlfile=1.1.0=pyhd8ed1ab_0
  - executing=1.2.0=pyhd8ed1ab_0
  - expat=2.5.0=hcb278e6_1
  - fftw=3.3.10=nompi_hc118613_107
  - flake8=6.0.0=pyhd8ed1ab_0
  - font-ttf-dejavu-sans-mono=2.37=hab24e00_0
  - font-ttf-inconsolata=3.000=h77eed37_0
  - font-ttf-source-code-pro=2.038=h77eed37_0
  - font-ttf-ubuntu=0.83=hab24e00_0
  - fontconfig=2.14.2=h14ed4e7_0
  - fonts-conda-ecosystem=1=0
  - fonts-conda-forge=1=0
  - fonttools=4.39.3=py311h2582759_0
  - freetype=2.12.1=hca18f0e_1
  - gettext=0.21.1=h27087fc_0
  - giflib=5.2.1=h0b41bf4_3
  - glib=2.76.2=hfc55251_0
  - glib-tools=2.76.2=hfc55251_0
  - gmp=6.2.1=h58526e2_0
  - gmpy2=2.1.2=py311h6a5fa03_1
  - graphite2=1.3.13=h58526e2_1001
  - greenlet=2.0.2=py311hcafe171_0
  - gst-plugins-base=1.22.0=h4243ec0_2
  - gstreamer=1.22.0=h25f0c4b_2
  - gstreamer-orc=0.4.33=h166bdaf_0
  - harfbuzz=6.0.0=h3ff4399_1
  - icu=72.1=hcb278e6_0
  - idna=3.4=pyhd8ed1ab_0
  - imagesize=1.4.1=pyhd8ed1ab_0
  - importlib-metadata=6.6.0=pyha770c72_0
  - importlib_metadata=6.6.0=hd8ed1ab_0
  - importlib_resources=5.12.0=pyhd8ed1ab_0
  - inflection=0.5.1=pyh9f0ad1d_0
  - intervaltree=3.0.2=py_0
  - ipykernel=6.22.0=pyh210e3f2_0
  - ipython=8.13.2=pyh41d4057_0
  - ipython_genutils=0.2.0=py_1
  - isort=5.12.0=pyhd8ed1ab_1
  - jack=1.9.22=h11f4161_0
  - jaraco.classes=3.2.3=pyhd8ed1ab_0
  - jedi=0.18.2=pyhd8ed1ab_0
  - jeepney=0.8.0=pyhd8ed1ab_0
  - jellyfish=0.9.0=py311hd4cff14_2
  - jinja2=3.1.2=pyhd8ed1ab_1
  - jinja2-time=0.2.0=pyhd8ed1ab_3
  - joblib=1.2.0=pyhd8ed1ab_0
  - jsonschema=4.17.3=pyhd8ed1ab_0
  - jupyter_client=8.2.0=pyhd8ed1ab_0
  - jupyter_core=5.3.0=py311h38be061_0
  - jupyterlab_pygments=0.2.2=pyhd8ed1ab_0
  - keyring=23.13.1=py311h38be061_0
  - keyutils=1.6.1=h166bdaf_0
  - kiwisolver=1.4.4=py311h4dd048b_1
  - krb5=1.20.1=h81ceb04_0
  - lame=3.100=h166bdaf_1003
  - lazy-object-proxy=1.9.0=py311h2582759_0
  - lcms2=2.15=haa2dc70_1
  - ld_impl_linux-64=2.40=h41732ed_0
  - lerc=4.0.0=h27087fc_0
  - libblas=3.9.0=16_linux64_openblas
  - libbrotlicommon=1.0.9=h166bdaf_8
  - libbrotlidec=1.0.9=h166bdaf_8
  - libbrotlienc=1.0.9=h166bdaf_8
  - libcap=2.67=he9d0100_0
  - libcblas=3.9.0=16_linux64_openblas
  - libclang=16.0.3=default_h83cc7fd_0
  - libclang13=16.0.3=default_hd781213_0
  - libcups=2.3.3=h36d4200_3
  - libdb=6.2.32=h9c3ff4c_0
  - libdeflate=1.18=h0b41bf4_0
  - libedit=3.1.20191231=he28a2e2_2
  - libevent=2.1.10=h28343ad_4
  - libexpat=2.5.0=hcb278e6_1
  - libffi=3.4.2=h7f98852_5
  - libflac=1.4.2=h27087fc_0
  - libgcc-ng=12.2.0=h65d4601_19
  - libgcrypt=1.10.1=h166bdaf_0
  - libgfortran-ng=12.2.0=h69a702a_19
  - libgfortran5=12.2.0=h337968e_19
  - libglib=2.76.2=hebfc3b9_0
  - libgomp=12.2.0=h65d4601_19
  - libgpg-error=1.46=h620e276_0
  - libiconv=1.17=h166bdaf_0
  - libjpeg-turbo=2.1.5.1=h0b41bf4_0
  - liblapack=3.9.0=16_linux64_openblas
  - libllvm16=16.0.3=hbf9e925_1
  - libnsl=2.0.0=h7f98852_0
  - libogg=1.3.4=h7f98852_1
  - libopenblas=0.3.21=pthreads_h78a6416_3
  - libopus=1.3.1=h7f98852_1
  - libpng=1.6.39=h753d276_0
  - libpq=15.2=hb675445_0
  - libsndfile=1.2.0=hb75c966_0
  - libsodium=1.0.18=h36c2ea0_1
  - libspatialindex=1.9.3=h9c3ff4c_4
  - libsqlite=3.40.0=h753d276_1
  - libstdcxx-ng=12.2.0=h46fd767_19
  - libsystemd0=253=h8c4010b_1
  - libtiff=4.5.0=ha587672_6
  - libtool=2.4.7=h27087fc_0
  - libudev1=253=h0b41bf4_1
  - libuuid=2.38.1=h0b41bf4_0
  - libvorbis=1.3.7=h9c3ff4c_0
  - libwebp=1.3.0=hb47c5f0_0
  - libwebp-base=1.3.0=h0b41bf4_0
  - libxcb=1.13=h7f98852_1004
  - libxkbcommon=1.5.0=h79f4944_1
  - libxml2=2.10.4=hfdac1af_0
  - libxslt=1.1.37=h873f0b0_0
  - libzlib=1.2.13=h166bdaf_4
  - lxml=4.9.2=py311h14a6109_0
  - lz4-c=1.9.4=hcb278e6_0
  - markupsafe=2.1.2=py311h2582759_0
  - matplotlib-base=3.7.1=py311h8597a09_0
  - matplotlib-inline=0.1.6=pyhd8ed1ab_0
  - mccabe=0.7.0=pyhd8ed1ab_0
  - mistune=2.0.5=pyhd8ed1ab_0
  - more-itertools=9.1.0=pyhd8ed1ab_0
  - mpc=1.3.1=hfe3b2da_0
  - mpfr=4.2.0=hb012696_0
  - mpg123=1.31.3=hcb278e6_0
  - mpmath=1.3.0=pyhd8ed1ab_0
  - munkres=1.1.4=pyh9f0ad1d_0
  - mypy_extensions=1.0.0=pyha770c72_0
  - mysql-common=8.0.32=ha901b37_1
  - mysql-libs=8.0.32=hd7da12d_1
  - nbclient=0.7.4=pyhd8ed1ab_0
  - nbconvert=7.3.1=pyhd8ed1ab_0
  - nbconvert-core=7.3.1=pyhd8ed1ab_0
  - nbconvert-pandoc=7.3.1=pyhd8ed1ab_0
  - nbformat=5.8.0=pyhd8ed1ab_0
  - ncurses=6.3=h27087fc_1
  - nest-asyncio=1.5.6=pyhd8ed1ab_0
  - nspr=4.35=h27087fc_0
  - nss=3.89=he45b914_0
  - numpy=1.24.3=py311h64a7726_0
  - numpydoc=1.5.0=pyhd8ed1ab_0
  - openjpeg=2.5.0=hfec8fc6_2
  - openpyxl=3.1.2=py311h459d7ec_0
  - openssl=3.1.0=hd590300_3
  - packaging=23.1=pyhd8ed1ab_0
  - pandas=2.0.1=py311h320fe9a_0
  - pandoc=2.19.2=h32600fe_2
  - pandocfilters=1.5.0=pyhd8ed1ab_0
  - parso=0.8.3=pyhd8ed1ab_0
  - pathspec=0.11.1=pyhd8ed1ab_0
  - patsy=0.5.3=pyhd8ed1ab_0
  - pcre2=10.40=hc3806b6_0
  - pexpect=4.8.0=pyh1a96a4e_2
  - pickleshare=0.7.5=py_1003
  - pillow=9.5.0=py311h573f0d3_0
  - pip=23.1.2=pyhd8ed1ab_0
  - pixman=0.40.0=h36c2ea0_0
  - pkgutil-resolve-name=1.3.10=pyhd8ed1ab_0
  - platformdirs=3.5.0=pyhd8ed1ab_0
  - pluggy=1.0.0=pyhd8ed1ab_5
  - ply=3.11=py_1
  - pooch=1.7.0=pyha770c72_3
  - prompt-toolkit=3.0.38=pyha770c72_0
  - prompt_toolkit=3.0.38=hd8ed1ab_0
  - psutil=5.9.5=py311h2582759_0
  - pthread-stubs=0.4=h36c2ea0_1001
  - ptyprocess=0.7.0=pyhd3deb0d_0
  - pulseaudio=16.1=hcb278e6_3
  - pulseaudio-client=16.1=h5195f5e_3
  - pulseaudio-daemon=16.1=ha8d29e2_3
  - pure_eval=0.2.2=pyhd8ed1ab_0
  - pycodestyle=2.10.0=pyhd8ed1ab_0
  - pycparser=2.21=pyhd8ed1ab_0
  - pydocstyle=6.3.0=pyhd8ed1ab_0
  - pyflakes=3.0.1=pyhd8ed1ab_0
  - pygments=2.15.1=pyhd8ed1ab_0
  - pylint=2.17.3=pyhd8ed1ab_0
  - pylint-venv=3.0.1=pyhd8ed1ab_0
  - pyls-spyder=0.4.0=pyhd8ed1ab_0
  - pyopenssl=23.1.1=pyhd8ed1ab_0
  - pyparsing=3.0.9=pyhd8ed1ab_0
  - pyqt=5.15.7=py311ha74522f_3
  - pyqt5-sip=12.11.0=py311hcafe171_3
  - pyqtwebengine=5.15.7=py311ha10a086_3
  - pyrsistent=0.19.3=py311h2582759_0
  - pysocks=1.7.1=pyha2e5f31_6
  - python=3.11.3=h2755cc3_0_cpython
  - python-dateutil=2.8.2=pyhd8ed1ab_0
  - python-fastjsonschema=2.16.3=pyhd8ed1ab_0
  - python-lsp-black=1.2.1=pyhd8ed1ab_0
  - python-lsp-jsonrpc=1.0.0=pyhd8ed1ab_0
  - python-lsp-server=1.7.2=pyhd8ed1ab_0
  - python-lsp-server-base=1.7.2=pyhd8ed1ab_0
  - python-slugify=8.0.1=pyhd8ed1ab_1
  - python-tzdata=2023.3=pyhd8ed1ab_0
  - python_abi=3.11=3_cp311
  - pytoolconfig=1.2.5=pyhd8ed1ab_0
  - pytz=2023.3=pyhd8ed1ab_0
  - pyxdg=0.28=pyhd8ed1ab_0
  - pyyaml=6.0=py311hd4cff14_5
  - pyzmq=25.0.2=py311hd6ccaeb_0
  - qdarkstyle=3.1=pyhd8ed1ab_0
  - qstylizer=0.2.2=pyhd8ed1ab_0
  - qt-main=5.15.8=h5c52f38_9
  - qt-webengine=5.15.8=h77d6d84_0
  - qtawesome=1.2.3=pyhd8ed1ab_0
  - qtconsole=5.4.2=pyhd8ed1ab_0
  - qtconsole-base=5.4.2=pyha770c72_0
  - qtpy=2.3.1=pyhd8ed1ab_0
  - readline=8.2=h8228510_1
  - requests=2.29.0=pyhd8ed1ab_0
  - rope=1.8.0=pyhd8ed1ab_0
  - rtree=1.0.1=py311h3bb2b0f_1
  - scikit-learn=1.2.2=py311h103fc68_1
  - scipy=1.10.1=py311h8e6699e_0
  - seaborn=0.12.2=hd8ed1ab_0
  - seaborn-base=0.12.2=pyhd8ed1ab_0
  - secretstorage=3.3.3=py311h38be061_1
  - setuptools=67.7.2=pyhd8ed1ab_0
  - sip=6.7.9=py311hb755f60_0
  - six=1.16.0=pyh6c4a22f_0
  - snowballstemmer=2.2.0=pyhd8ed1ab_0
  - sortedcontainers=2.4.0=pyhd8ed1ab_0
  - soupsieve=2.3.2.post1=pyhd8ed1ab_0
  - sphinx=7.0.0=pyhd8ed1ab_0
  - sphinxcontrib-applehelp=1.0.4=pyhd8ed1ab_0
  - sphinxcontrib-devhelp=1.0.2=py_0
  - sphinxcontrib-htmlhelp=2.0.1=pyhd8ed1ab_0
  - sphinxcontrib-jsmath=1.0.1=py_0
  - sphinxcontrib-qthelp=1.0.3=py_0
  - sphinxcontrib-serializinghtml=1.1.5=pyhd8ed1ab_2
  - spyder=5.4.3=py311h38be061_0
  - spyder-kernels=2.4.3=unix_pyhd8ed1ab_0
  - sqlalchemy=2.0.12=py311h459d7ec_0
  - stack_data=0.6.2=pyhd8ed1ab_0
  - statsmodels=0.13.5=py311h4c7f6c3_2
  - sympy=1.11.1=pypyh9d50eac_103
  - text-unidecode=1.3=py_0
  - textdistance=4.5.0=pyhd8ed1ab_0
  - threadpoolctl=3.1.0=pyh8a188c0_0
  - three-merge=0.1.1=pyh9f0ad1d_0
  - tinycss2=1.2.1=pyhd8ed1ab_0
  - tk=8.6.12=h27826a3_0
  - toml=0.10.2=pyhd8ed1ab_0
  - tomli=2.0.1=pyhd8ed1ab_0
  - tomlkit=0.11.8=pyha770c72_0
  - tornado=6.3=py311h2582759_0
  - traitlets=5.9.0=pyhd8ed1ab_0
  - typing-extensions=4.5.0=hd8ed1ab_0
  - typing_extensions=4.5.0=pyha770c72_0
  - tzdata=2023c=h71feb2d_0
  - ujson=5.7.0=py311hcafe171_0
  - unidecode=1.3.6=pyhd8ed1ab_0
  - urllib3=1.26.15=pyhd8ed1ab_0
  - watchdog=3.0.0=py311h38be061_0
  - wcwidth=0.2.6=pyhd8ed1ab_0
  - webencodings=0.5.1=py_1
  - whatthepatch=1.0.4=pyhd8ed1ab_0
  - wheel=0.40.0=pyhd8ed1ab_0
  - wrapt=1.15.0=py311h2582759_0
  - wurlitzer=3.0.3=pyhd8ed1ab_0
  - xcb-util=0.4.0=h516909a_0
  - xcb-util-image=0.4.0=h166bdaf_0
  - xcb-util-keysyms=0.4.0=h516909a_0
  - xcb-util-renderutil=0.3.9=h166bdaf_0
  - xcb-util-wm=0.4.1=h516909a_0
  - xkeyboard-config=2.38=h0b41bf4_0
  - xlrd=2.0.1=pyhd8ed1ab_3
  - xlsxwriter=3.1.0=pyhd8ed1ab_0
  - xorg-kbproto=1.0.7=h7f98852_1002
  - xorg-libice=1.0.10=h7f98852_0
  - xorg-libsm=1.2.3=hd9c2040_1000
  - xorg-libx11=1.8.4=h0b41bf4_0
  - xorg-libxau=1.0.9=h7f98852_0
  - xorg-libxdmcp=1.1.3=h7f98852_0
  - xorg-libxext=1.3.4=h0b41bf4_2
  - xorg-libxrender=0.9.10=h7f98852_1003
  - xorg-renderproto=0.11.1=h7f98852_1002
  - xorg-xextproto=7.3.0=h0b41bf4_1003
  - xorg-xf86vidmodeproto=2.3.1=h7f98852_1002
  - xorg-xproto=7.0.31=h7f98852_1007
  - xz=5.2.6=h166bdaf_0
  - yaml=0.2.5=h7f98852_2
  - yapf=0.32.0=pyhd8ed1ab_0
  - zeromq=4.3.4=h9c3ff4c_1
  - zipp=3.15.0=pyhd8ed1ab_0
  - zlib=1.2.13=h166bdaf_4
  - zstd=1.5.2=h3eb15da_6
prefix: /home/philip/mambaforge/envs/spyder

This is a small file which gives the details about the Python environment which can be emailed or copied.

Creating an Environment from a yml File

A Python environment can be created from a yml file in Mambaforge using:


(base) philip@pc:~ $ mamba env create -n spyder -f ~/Documents/spyder.yml

Or in Anaconda using:


(base) philip@pc:~ $ conda env create -n spyder -f ~/Documents/spyder.yml

The Python environment spyder is created:

  Summary:

  Install: 331 packages

  Total download: 0 B

───────────────────────────────────────────────────────────────────────────────────────────────────────



Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate spyder
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) philip@pc:~ $