Setting up your python environment

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, consider installing mamba into your existing installation using the command conda install -c conda-forge mamba. Alternatively, you can simply replace the mamba commands below with conda.

  1. Open your terminal.

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

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

    • Linux: Open your terminal application

  2. Navigate to the elastix_tutorial/notebooks subdirectory of the directory you downloaded.

    cd <path to downloaded repository>/elastix_tutorial/notebooks
    
  3. The file environment.yml contains the dependencies needed to run the notebooks, and it specifies a conda environment named elastix_tutorial. Create this environment from the file by entering the following command.

    mamba env create --file environment.yml
    
  4. Once the environment setup has finished, activate the environment. If you successfully activated the environment, you should now see (elastix_tutorial) to the left of your command prompt.

    conda activate elastix_tutorial
    
  5. 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
    
  6. Test and run your notebook installation. We will be using notebook for interactive analysis. Enter the command below and it should launch jupyter notebook book in a web browser. Navigate to the notebooks from there to open and work on them.

    jupyter notebook