Setting up your python environment#

Installing python via mambaforge#

In this tutorial, we will install python via mambaforge, a distribution of anaconda python. However, if you already have anaconda, miniconda, mambaforge, or miniforge installed, those will work as well and you can skip to the next section.

To install python via mambaforge, follow the instructions here.

Setting up your environment#

Using conda instead of mamba?

The following assumes that you have installed python using Mambaforge as described above. If you are using a pre-existing installation of python via anaconda, miniconda, or miniforge, you can simply replace the mamba commands with conda.

  1. Open your terminal.

    • Linux: Open your terminal application

    • Mac OS: Open Terminal (you can search for it in spotlight - cmd + space)

    • Windows: Open the “mambaforge prompt” or “miniforge prompt” from your start menu

  2. We use an environment to encapsulate the python tools used for this workshop. This ensures that the requirements for this workshop do not interfere with your other python projects. To create the environment (named napari-tutorial), run the command below.

    mamba env create -f https://raw.githubusercontent.com/kevinyamauchi/eth-napari-workshop/main/environment.yaml
    
  3. Once the environment setup has finished, activate the environment. If you successfully activated the environment, you should now see (napari-tutorial) to the left of your command prompt.

    mamba activate napari-tutorial
    
  4. If you are on a Mac or linux, please install these additional dependencies.

    mamba install -c conda-forge ocl-icd-system
    
    mamba install -c conda-forge python.app ocl_icd_wrapper_apple
    
  5. Test that your notebook installation is working. We will be using notebook for interactive analysis. Enter the command below and it should launch jupyter notebook book in a web browser. Once you’ve confirmed it launches, close the web browser and press ctrl+c in the terminal window to stop the notebook server.

    jupyter notebook
    
  6. Test your napari installation. Enter the command below and an empty napari viewer should open. You can close the window after it opens. Please note that it takes a bit of extra time to launch napari the first time.

    napari
    

Errors launching?

If you receive an error when attempting to launch and/or install napari, you can ask for help on: