Skip to content

Miniconda

Introduction

The python version that is default available on on your computer or the server you want to use might not be the right version for you. Also the available packages can be either outdated or not sufficient for your task. As you might not have the right permissions (e.g. on a server) to change the default system and to have full control over the python versions and packages it is better to setup and maintain your own python-system and packages.

This manual will help you setup Miniconda package. Using Miniconda you can setup your own python-system in your homedirectory, switch between so-called virtual environments and install packages inside these environments. Its ‘larger’ brother is well known under the name of Anaconda. Both Miniconda and Anaconda use the same conda application.

This manual with help you setting up Miniconda and activating and creating a new virtual environment. More information can be found here:

Setting up Miniconda

Linux and macOS

These instructions can be directly used in Linux and macOS. Windows instructions will follow shortly. In the examples we will use Linux:

Note

the disk-space in the home-directory on the HPC-cluster is relatively small. On this cluster use the bulk-storage to store the miniconda installation. The bulk-storage is located here /tudelft.net/staff-bulk; extend this path to your preferred location for storing miniconda. Also read SSHFS on how to use bulk-storage.

  1. Download Miniconda in your home-directory. Find the Python 3 version for your operating system: https://docs.conda.io/en/latest/miniconda.html. Use wget to download the installer for Linux:

    $ wget 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh'
    
  2. Execute the installer and follow the prompts on the installer screens. Accept the defaults (read the note above about the HPC-cluster) as you can change them later:

    $ bash Miniconda3-latest-Linux-x86_64.sh
    
  3. Close your connection with exit and login again to the server

  4. You can now test your installation and check if a list of installed packages appears:

    $ conda list
    
  5. You can also check the available virtual environments (this should only be the base-environment):

    $ conda env list
    

Warning

When you use conda and get an error like this: command not found, this could mean the environment for miniconda is not initialized during login. In most cases this can be easily solved with the following command

$ ln -s .bashrc .bash_profile

However this only works if .bash_profile does not already exists. If this however is the case you can also try to append source $HOME/.bashrc to your .bash_profile. In both cases make sure you logout and login afterwards and test if conda can be executed.

Windows

These instructions install Miniconda in Windows. To ease configuration and tailoring to your needs we will install this software in Just Me-mode with user-rights and not admin-rights and in your user-directory:

  1. Download Miniconda from this location: https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
  2. Execute the installer and accept the default settings. In the Install for:-window make sure you select Just Me. In the Destination Folder-window check your user-directory (e.g. C:\Users\<username>\miniconda3)
  3. Open the Anaconda Powershell Prompt (miniconda)
  4. Check the installation by typing in the prompt-window
# show installed packages
> conda list
# show available virtual environments
> conda env list

Activating conda

You can activate your default conda virtual environment base with the following command:

$ conda activate

or:

$ conda activate base

You can also turn on or off automatic activation of the base environment after login. To turn it off do:

$ conda config --set auto_activate_base false

Creating new virtual environment

You can create a new virtual environment <env_name> with the following command:

$ conda create -n <env_name>

This will create an empty framework in which you can now install packages:

# first activate this new environment
$ conda activate <env_name>
# install your required python version and packages
$ conda install python=3.7 numpy matplotlib

It is also possible to install packages during the creation of a new environment:

$ conda create -n <env_name> python=3.7 numpy matplotlib

Tip

much more useful information can be found here:
https://docs.conda.io/projects/conda/en/latest/user-guide/index.html


Last update: 2020-11-30