Course preparation#

Before the course starts, remember to install Napari and Jupyter - see sections of this page. Make use of the napari chatroom for troubleshooting if you face installation issues.

Napari Installation Guide: https://napari.org/dev/tutorials/fundamentals/installation.html

Jupyter Installation Guide: https://jupyter.org/install

Managing environments#

First, you need to install a tool called an environment manager in your computer. To learn more about environments we reccomend to read the dedicated teaching material on environments. For this course we will use conda or its variants mamba and micromamba. If you already have one of those tools, great! Skip to the next section. Otherwise, we recommend installing micromamba. Follow the instructions for your operating system:

NOTE: Pre-exsisting Anaconda on our computer#

If you already have Anaconda installed on your system this can lead to issues with running (micro)mamba - due to CONDA env vars and prefixes. Anaconda has been very well popularized in the past but it is not reccomended to run new and fast changing modular systems like napari. In principle, it should be possible to run micromamba in parallel to your Anaconda installation, but it might require some trouble shooting. One option is to let those folks keep using their existing anaconda with conda-forge and lib mamba solver referencing to: https://conda-forge.org/docs/user/introduction.html#how-can-i-install-packages-from-conda-forge https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community

We reccomend to uninstall Anaconda (following guides in the internet). If you want to run your old scripts in the same environment that you accessed through the Anaconda interface in the past, you can create the same environment again from your new system by typing mamba create -n anaconda -c anaconda anaconda python=3.8. This will pull the anaconda meta package from the anaconda channel and make a new env named anaconda for you with python 3.8. You can change the python version as needed.

Even if you have multiple conda setups, you can make it work. It’s just that names will not be sufficient. Here’s an example where the conda napari bundle is installed in a conda environment using: mamba env list I get:

...
rosetta                  /Users/piotrsobolewski/Dev/miniforge3/envs/rosetta
                         /Users/piotrsobolewski/Library/napari-0.4.18rc2
                         /Users/piotrsobolewski/Library/napari-0.4.18rc2/envs/napari-0.4.18rc2

You can see my miniforge3 env rosetta by name, but others from the bundle don’t have proper names. Still, mamba activate /Users/piotrsobolewski/Library/napari-0.4.18rc2 works correctly in this example.

If you don’t have Anaconda, or you have uninstalled it already, you can follow the (micro)mamba installation instructions for your operating system:

macOS#

If you are a macOS user and have installed Homebrew, open the Terminal application, and type:

brew install micromamba

And press Enter. If you don’t have Homebrew, you’ll see an error message:

zsh: command not found: brew

If that’s the case, copy and paste this command into the Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

And follow the prompts. This will install Homebrew. Then you can try brew install micromamba again.

After you have installed micromamba, you have to configure it.

First, we make sure that micromamba can create and activate environments in your Terminal. To do this, type:

micromamba shell init -s zsh -p ~/micromamba

into your shell, then the following:

source ~/.zshrc

Finally, we configure the default channels, which is where micromamba looks for Python packages to install. Copy the following lines:

channels:
  - conda-forge
  - ome

and type the following into your Terminal:

pbpaste > ~/.mambarc

(This creates a file called .mambarc in your home directory containing the above lines of text, and they tell micromamba to look for packages in two places: the conda-forge channel, and, if that fails, the ome channel.)

Linux#

Install micromamba by following the instructions here.

Windows#

Note, the installation of micromamba can be more challenging on Windows. We reccommend using mamba instead by installing mamba-forge.

If you want to try setting up the fast and slim micromamba anyways, open a PowerShell terminal and type the following commands to install and configure micromamba for Windows:

Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile micromamba.tar.bz2
tar xf micromamba.tar.bz2

MOVE -Force Library\bin\micromamba.exe micromamba.exe
.\micromamba.exe --help

$Env:MAMBA_ROOT_PREFIX=$HOME\envs

.\micromamba.exe shell init -s powershell -p $HOME\envs

If this does not work for you on Windows PowerShell (the $HOME was an issue for some and your username had to be added), please follow the instructions on the micromamba / mamba installation page instead.

Creating the environment for this course#

We have created an environment file for this course that specifies all the software needed to run the content in the course. You can use micromamba to install it.

You will need to download and unzip this repository. Then, navigate to the root of the repository in your Terminal (macOS/Linux) or PowerShell (Windows), and type:

micromamba create -f environment.yml

Follow the prompts, then type:

micromamba activate napari-latam
napari

After some time (napari takes time to launch the first time), you should see a napari window open. You should be able to click the menu File > Open Samples > clEsperanto > blobs (from ImageJ) and see an image appear.

To quit napari you can close the window or use control c in the terminal. To open jupyter lab (jupyter notebook editor) to see the course content and excecute the excersizes, type:

jupyter lab

Later during the excercises we will launch the napari viewer from the jupyter notebooks.

Troubleshooting#

Graphics cards drivers#

In case error messages contains “ImportError: DLL load failed while importing cl: The specified procedure could not be found” see also or “”clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR”, please install recent drivers for your graphics card and/or OpenCL device. Select the right driver source depending on your hardware from this list:

Sometimes, mac-users need to install this:

micromamba install -c conda-forge ocl_icd_wrapper_apple

Sometimes, linux users need to install this:

micromamba install -c conda-forge ocl-icd-system

In case installation didn’t work in the first attempt, you may have to call this command line to reset the napari configuration:

napari --reset