Installing ISIS on Windows using WSL

During the installation of a complicated Science Stack I had the necessity to install the ISIS package link on my Windows machine. While it probably is the easiest to develop most applications with Linux, some people have different good reasons to work with Windows even if some things become more complicated.

In the following I will outline how to install ISIS on a Windows 11 machine using WSL 2, in theory this should also work at the very least similar if not exactly the same on Windows 10 for those that have yet to upgrade to Windows 11, or maybe are barred due to the Minimum Requirements.

I will not go into details on how to install WSL as this is outlined by Microsoft here much better than I could ever do myself. I will only say that I am using WSL 2, which is required if you want to use any of ISIS’ GUI tools, and Ubuntu 22.04 LTS.

Now that we are started we open WSL in the Windows Terminal or from the CMD with the command:

wsl

Then our WSL distro should open and you should have the corresponding shell opened.

We then go over to install miniforge (or alternatively mambaforge)

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

Once we have miniforge installed, we can basically follow the instructions to install ISIS step by step as the WSL environment behaves nigh identical to a normal Linux install.

Thus we start by creating our ISIS conda environment:

conda create -n isis python=3.9 

this is the conda environment that will only be used to install isis and do nothing else, as anything else done in this environment might potentialy break the isis install.

conda activate isis

after activating the isis environment we add the usgs astrogeology channel, and the conda-forge channel, as we use miniforge the conda-forge channel should already be installed.

conda config --env --add channels conda-forge #only needed when not using miniforge/mambaforge
conda config --env --add channels usgs-astrogeology

To ensure we have the correct channels set we verify by:

conda config --show channels

where we expect to see:

 channels:
    - usgs-astrogeology
    - conda-forge

It is important that the usgs-astrogeology channel is 1st and the conda-forge channel is 2nd IF: this is not the case please rerun the following:

conda config --env --add channels usgs-astrogeology

and lastly we need to set the channel priority to flexible:

conda config --env --set channel_priority flexible

Now we have set all the prerequisites for installing ISIS, here is were we differ a little bit from the ISIS package install instructions, for the sake of our sanity. Since TODO miniforge bundles in the much faster solver mamba to conda which we will use to install ISIS, within much less than the 1-2 hours outlined by the install instructions:

mamba install -c usgs-astrogeology isis

after the install has finished we only have to setup the environment variables such that ISIS can find them within the conda environment:

conda env config vars set ISISROOT=$CONDA_PREFIX ISISDATA=[path to data directory]

now you only need to reactivate the conda environment for the environment variables to be set

conda activate isis

Now we have finished installing ISIS into Windows WSL now to check if everything is working well, we can try to run the qview command from within the isis environment. This should take a moment and we should be able to see the following window:

Additionaly you want to potentialy use the ISIS tools in combination with other tools from python or similar without breaking the ISIS install.

This can be done by creating a new conda environment:

conda create -n science  
conda activate science

and then adding 3 environment Variables:

the previously set ISISROOT and and ISISDATA

conda env config vars set ISISROOT=[ISISROOT path from isis env] ISISDATA=[path to data directory]

where the ISISROOT needs to point to the ISISROOT path from the isis environment.

Lastly you want to add the path to the binaries to the path variables

export PATH=$PATH:$ISISROOT/bin

this needs to be reset every time you reopen your shell otherwise you want to add it to your /etc/bash.bashrc file for it to be activated in every bash shell.