Tool installation

Learning Objectives

After completing this lesson, learners should be able to:
  • Install the software that is required to execute the activities in this training material

Motivation

Provide instructions for installing the software required for this workshop. Please follow the instructions given by your trainer regarding which software you will need!

Concept map

graph TD I("Image Analysis") -->|with| C("Computer") C -->|using| T("Tools") T -->|require| S("Installation")



Figure


Screenshot of the community partners of https://forum.image.sc, containing many very useful bioimage analysis tools.



Running bioimage analysis software

Hardware

Bioimage analysis software can be run either locally on your own computer or remotely on a cloud-based system. Each approach has its advantages and limitations:

Local (Your Computer)

  • Pros:
    • No internet connection required.
    • Smooth interaction with screen, mouse, and keyboard.
  • Cons:
    • Limited hardware resources.
    • Potential challenges with software installation.

Remote (Cloud-Based)

  • Pros:
    • Access to powerful, dedicated hardware.
    • Preinstalled and ready-to-use software.
  • Cons:
    • Requires network access.
    • Limited ability to modify or install additional software.
    • Screen rendering may be slower due to network latency.

Sofware

Package managers

Package managers are software that can install libraries (packages) on your computer that are needed to develop and run bioimage analysis appllications. Prominent examples are maven for managing Java and conda for managing Python and other libraries; pip is a relatively old and well-known package manager, specific to Python; we have heard good things about uv as a modern Python package manager. Generally, the landscape of Python package managers is evolving and hard to keep track of.

Conda
  • Conda is a software that you need to install on your computer
  • Conda is a so-called package manager that will download software packages onto your computer
  • Initially, conda was mainly for downloading python packages, thus the “snake” name, but now conda evolved to be a general purpose package manager
  • Now, there are many variants of conda (mamba, micromamba, miniforge, …); those will all install the same software packages on your computer, but will do this more or less fast and well
Example use with explanations

conda create -n skimage-napari-tutorial --override-channels -c conda-forge -c euro-bioimaging -c nodefaults python=3.10 napari=0.4.17 notebook matplotlib jupytext "scikit-image>=0.20" openijtiff "numpy<2"

  • conda create -n skimage-napari-tutorial: Asks conda to create a new “environment” on your computer with the name (-n) skimage-napari-tutorial
    • This simply creates a folder on your computer called skimage-napari-tutorial into which conda will download stuff
  • --override-channels -c conda-forge -c euro-bioimaging -c nodefaults: Tells conda from where to download the software, a “channel” -c is one place that hosts conda packages
    • ` -c nodefaults`: The reason to adding this was that the licensing of the default distribution channel for conda packages changed such that even academic institutions are not allowed anymore to use them
  • python=3.10 napari=0.4.17: We require specific versions of those packages, the versions of other packages that don’t have the = will be chosen automatically by conda such that, hopefully, everything is compatible
  • “scikit-image>=0.20” & “numpy<2”: Limits the range of versions to be above or below a certain version
    • scikit-image>=0.20 this was done here to make sure that the installation contains a nice new feature of scikit-image that was only available from version 0.20 on and, back then, the version that conda would download by default was lower than this
    • numpy<2: Typically, if the so-called major version changes, e.g. 1.9 goes to 2.0, there are “breaking changes”; this was also the case for numpy and, back then, many other packages that use numpy were not yet ready to use the new 2.0 version leading to errors.

General notes:

  • The specific software that is downloaded by an identical conda command will differ depending on your operating system and on your hardware (e.g. newer Mac computers have a different chip for which conda will need to download other packages than for older Mac)
    • As a consequence, unfortunately, the same conda command may produce a working environment on some computers while it may not work on others



Activities

Install ImageJ

Install the ImageJ GUI and a scripting editor.


Show activity for:  

Fiji

Fiji bundles the ImageJ GUI, a scripting editor and various plugins; additional plugins can be readily installed via so-called update sites.

  1. Install Fiji on your machine, as described here.
  2. Add the following Fiji updates sites, as described here.
    • IJPB-Plugins
    • BioVoxxel

IntelliJ

IntelliJ is an IDE for developing Java code. It can be used to develop and run ImageJ code.

  1. TODO
  2. TODO



Install skimage & napari

Install the python library skimage for image analysis and the napari viewer for image inspection.


Show activity for:  

conda

Installation

Install a conda package manager

If you already have a conda package manager you can skip this step.

Important: If you cannot open the miniconda website, please install miniforge following the instructions; if you however can access miniconda please follow the below instructions.

  1. Install miniconda see also here. It is best to install as local user.
    • Windows: the graphical installer works well. You can get it from the repo directly
    • OSX: install using the MacOS terminal installer. This is the version that allows a local install. Install in the suggested path ~/miniconda3
  2. Open a (new) terminal window
    • Windows: Anaconda Prompt (Miniconda3), e.g. type Anaconda in the search bar
    • OSX: Open a terminal window. If conda is active you see (base) left of the shell prompt. If you do not see (base) you may have to manually activate the environment as described here by typing
        source ~/miniconda3/bin/activate
      

Install the course environment

Within a terminal window execute

conda create -n skimage-napari-tutorial --override-channels -c conda-forge -c euro-bioimaging -c nodefaults python=3.10 napari=0.4.17 numpy notebook matplotlib jupytext scikit-image openijtiff napari-plot-profile

This will create an environment named skimage-napari-tutorial with the necessary packages for the course.

Use the course environment

Activate the environment and open a notebook

  1. Create a directory called skimage-napari-tutorial (e.g. on your Desktop)
  2. Open a terminal window (see above)
  3. Go into the above directory cd skimage-napari-tutorial
  4. conda activate skimage-napari-tutorial
  5. jupyter notebook or jupyter lab

Test the environment

Activate the environment and open a notebook (see above).

  1. Download test_installation_skimage_napari.py to the skimage-napari-tutorial directory.
  2. Richt-click on test_installation_skimage_napari.py and choose Open with -> Notebook. You will get a notebook with preconfigured cells. Run the cells one by one (Run button or Shift-Enter). The napari GUI will show twice the same image.
  3. Create a new notebook
    • New > Python 3
    • type following commands in a cell and execute the cell by pressing the Run button or Shift-Enter.
# %% [markdown]
# # Test python napari skimage install

# %%
# Instantiate the napari viewer
import napari
viewer = napari.Viewer()

# %%
# Read the intensity image
from skimage.io import imread
fpath = 'https://github.com/NEUBIAS/training-resources/raw/master/image_data/xy_8bit__two_cells.tif'
image = imread(fpath)

# %%
# View the intensity image
viewer.add_image(image)

# %%
# Read via OpenIJTIFF (OpenIJTiff.py must be in the same folder as the notebook path)
from OpenIJTIFF import open_ij_tiff
image_opentiff, axes, scales, units = open_ij_tiff(fpath)
# View the intensity image
viewer.add_image(image_opentiff)

Run code in the environment

Activate the environment (see above).

To run code either:

  • (with package jupytext) create an empty file, e.g. my_code.py in the skimage-napari-tutorial directory. Copy the activity code to this file and save the file. From the jupyter main landing page right-click on the file and choose Open with -> Notebook.
  • Create a new notebook New > Python 3 and copy the code in the activity into the notebook.

Troubleshooting

Ubuntu: Napari fails to show 3D viewer

We’ve encountered an OpenGL error for the napari 3D viewer on a Ubuntu machine when using the conda environment installed as described above.

This installation procedure got it to work (Note: not yet tested for all modules):

conda create -n skimage-napari-tutorial --override-channels -c conda-forge python=3.9
conda activate skimage-napari-tutorial
pip install napari[all]
pip install notebook
pip install jupytext
conda install --override-channels -c conda-forge -c euro-bioimaging -c nodefaults openijtiff

BAND

New BAND users

  1. Go to band.embl
    • We recommend using Chrome or Firefox browsers. Please avoid using IE as it is not supported. Safari and Opera may be ok as well, but they are not thoroughly tested.
  2. Agree to the Terms of Use and Privacy Notice and click the “Login” button.
    • We recommend Google authentication.
  3. After entering your credentials, check your emails for a confirmation email. It will typically take a maximum of 5 mins. Please also check your spam folder.
    • Do not try to use the BAND before you receive the confirmation email.
    • Please contact cbbcssupport@embl.de if you do not receive your confirmation email within 10 mins.
  4. Once you receive your confirmation email, go back to band.embl.de and log in again.

  5. You will be automatically redirected to the “Launch desktop” page after successful login.

  6. Please choose the following desired configurations (CPUs, Memory, GPUs, Screen resolution, and desktop running time).
    • No. of CPUs = 1
    • Memory (gb) = 2
    • No. of GPUs = 0
    • Resolution = your preference
    • Time (days) = 1
  7. Click “Launch Desktop”

    • If you encounter an error launching a desktop, please contact us at cbbcssupport@embl.de.
    • One user is only allowed to have 1 running desktop.
  8. Your desktop will be available in the ”Running Desktop” section if the launch is successful.
    • If this is your first time using the BAND, you may see a red error message appear after clicking “Go to Desktop”. If you see it, please simply stop the desktop and re-launch. The error is due to system and network limitations. It will go away, and the performance of your desktop will be optimal from your second desktop onwards.

    • If the “Go to desktop” button is greyed out, it means there are not enough resources available for your request. In this case, you have two options: 1) Stop your desktop and adjust your configurations. Lower the requested number of CPU, Memory, or GPU and launch again. 2) Wait until other users release their desktops so that more resources become available. The “Show Desktop” will automatically become clickable once there are enough resources.

  9. Click “Go to desktop” to view your desktop in a new browser tab.
    • Click “SSH to Desktop” if you prefer a command-line interface.
  10. Once your desktop appears in a new tab, you can access all the available software from the Application menu on the top left of your screen.

  11. After using your desktop, close the browser tab and click the “Stop desktop” button from the launch screen.

Existing BAND users

  1. Go to band.embl
  2. Click “Login” from the menu and then continue from step 5 above.

Launch skimage/napari

To execute the below steps you need to open a terminal window:

terminal

…and you also need to open an Application:

applications

  1. Open a Terminal and execute

     - cd Documents # go to the Document folder
     - mkdir skimage-napari-tutorial # create a folder called skimage-napari-tutorial
     - cd skimage-napari-tutorial
     - wget https://neubias.github.io/training-resources/functions/OpenIJTIFF.py
    
  2. Go to “Applications Places->Programming->JupyterLab”. Select ‘napari.tensorflow’ Kernel

  3. Save the jupyter note-book file in skimage-napari-tutorial folder

     File>Save Notebook As …> Documents/skimage-napari-tutorial/”FileName”.ipynb
    
  4. We have napari from the menu. Or if you prefer to start napari within Jupyter, just type “%gui qt5” and ignore the warnings.

BAND tipps

  1. Do not run the “skill ” command, which may affect your running session and do not “scancel” the slurm job running your desktop session.
  2. Do not use any .bashrc in your home directory. It will cause the guacamole connection error.
  3. DO NOT store large files in /home, move or download large files to /scratch. If /home is full, BAND will break. THIS IS IMPORTANT.
  4. Refer to User guide for copy & paste instructions
  5. Use pure Google accounts or accounts that purely managed by Google. Account linking, for example, login with Hotmail with account linking to Google may not work.
  6. User data stored in /home and /scratch persists between desktop sessions. Stop desktop will not lose data.
  7. Recommend to log in to BAND at least once before the course. This is to give enough time to fix issues if there are any.



Install napari standalone app

Install napari standalone app


Show activity for:  

desktop download

Open this link and navigate to Assets and click on the downloader according to your own system




Install Galaxy

Install the Galaxy instance.


Show activity for:  

Start a local Galaxy

To setup a Galaxy server locally, we will first clone the Galaxy github repository, make a few small edits to the galaxy.yaml configuration file, and then start the server.

  1. Clone the github repository with release_23.2 branch.

     git clone -b release_23.2 https://github.com/galaxyproject/galaxy.git
     cd galaxy
    
  2. Add yourself as admin user in config/galaxy.yaml

     cp config/galaxy.yml.sample config/galaxy.yml
    
  3. open the galaxy.yml file with your favorite editor and edit the following line with your email address:

    admin_users: user@example.org .

  4. Start Galaxy

     sh run.sh
    
  5. Galaxy will now install all its requirements, which may take a few minutes, when all is finished installing, you should see something like this in your screen:

    Starting server in PID 9560.
    serving on http://localhost:8080

  6. Open Galaxy
    • Open a web browser
    • Navigate to localhost:8080 to access Galaxy
  7. Register an account on Galaxy using the email address you added to the config/galaxy.yml file. Once logged in, verify that you have a menu item named Admin in your top menu bar.

  8. Pull Galaxy tools from toolshed
    • Click on the Admin menu.
    • On the left pane, click on Install and Uninstall under the Tool Management section.
    • Search for the tools via the ```Search Repositories`` text box on top of the main window.
    • Click on the repository name to expand it.
    • Click Install to install the tool into your local Galaxy.

Using Galaxy EU

Galaxy Europe is the biggest Galaxy instance in Europe and one of the biggest worldwide.

  • Free registration
    • Navigate to usegalaxy.eu
    • Click Log in or Register from the top menu.
    • Click Register here to start registration process.
    • Fill in the required fields and click the Create button.
    • A confirmation email will be sent to your email address. Once the email is confirmed, you can start using the Galaxy Europe platform.










Follow-up material

Recommended follow-up modules:

Learn more: