Installing MountainSort (on the Windows Subsystem for Linux) Draft

Posted by Geoff, Published: 4 years, 11 months ago (Updated: 4 years, 7 months ago)

This page will take you through setting up MountainSort on your WSL. These set of instructions follow the directions provided on the GitHub1 page for MountainSort so feel free to follow their instructions instead as this post was written on May 1st, 2019.

Install Conda

The documentation suggests using conda to install MountainSort, so lets not go against the grain here. I am not the biggest fan of conda to begin with as it generally creates some awkward conflicts with my other Python installations. However, this instance of conda should be isolated to WSL and thus should not create too many conflicts.

  1. First we will to launch WSL by typing the following command into the Windows command prompt:
    # or use version if necessary, example for the Ubuntu 18.04 app
  2. Download conda for the WSL by using the following command in the Ubuntu terminal:
    wget -O
  3. Now we will batch install conda to the ~/conda directory with the following Ubuntu command:
    bash -bp ~/conda
  4. Next we will initialize conda, this command will export the conda $path as an environment variable by adding it to the ~/.bashrc file:
    conda init
    • You might receive the following response due to the conda init command: conda: command not found. If so, you will need to add the conda $path manually with the following command:
      export PATH=~/conda/bin:$PATH
      Now if you redo the conda init command you should be able to successfully setup conda.
  5. It will likely ask that you re-open the shell. So re-launch the WSL.
  6. When you launch it might have activated a sample environment called base. You know an environment is active if the terminal says the name of an environment in parentheses before the username@computer_name, an example is pictured below:
    • If this environment is not activated, activate it by typing the following command:
      conda activate base
  7. Update the conda base environment with the following command:
    conda update conda
  8. Create an environment for MountainLab/MountainSort, we will call our environment mlab:
    conda create -n mlab
    • You will likely have you confirm your environment location.
  9. Now we are going to add a line to the ~/.bashrc file that will allow us to automatically activate our mlab environment when we start the WSL.
    1. open the ~/.bashrc file by typing the following command:
      sudo nano ~/.bashrc
      • You will likely have to provide your password due to it being a sudo command.
    2. Scroll all the way to the bottom of the ~/.bashrc file and add the following line:
      conda activate mlab
    3. Type Ctrl+X to exit, then press Y key to save the changes, followed by Enter to confirm.
    4. Now if you close and re-open the WSL, you will see that the mlab environment is active.

MountainSort Installation

  1. Ensure that your mlab environment is active (or whatever you called the environment) with the use of conda activate environment_name.
  2. Now we can install the appropriate MountainLab and MountainSort packages with the following command:
    conda install -c flatiron -c conda-forge \
    			mountainlab \
    			mountainlab_pytools \
    			ml_ephys \
    			ml_ms3 \
    			ml_ms4alg \
    • You will likely have to continue confirming the installation by pressing the Y key.
  3. At a later date, if you wanted to update the MountainSort and MountainLab packages you can use the following command:
    conda update -c flatiron -c conda-forge \
    			mountainlab \
    			mountainlab_pytools \
    			ml_ephys \
    			ml_ms3 \
    			ml_ms4alg \
  4. Test that the installations were successful with the following command:

    You should see a list of processors that you can use within MountainSort similar to the image below.

MountainLab Configuration

Before being able to run MountainSort, we have to configure MountainLab properly. MountainLab will save temporary/intermediate files within a specified directory, but we need to specify which one to save it in. These directories will also have to belong to the same drive where the data is stored.

  1. Identify which drive you will be using for the analysis and note the letter. For example, the drive that Windows is installed on is generally called the "C:" drive, a secondary drive might be named "D:". In our case I will always be moving the data to the external D: drive. 
  2. Create a directory in your chosen drive that will contain temporary files produced by Mountainsort/MountainLab. For example I will create the following directory: D:\MountainSortTemp
  3. Now lets configure MountainSort by typing in the following command:
    • You want to modify the ML_TEMPORARY_DIRECTORY variable. These variables are stored and referenced in a mountainlab.env file within your mountainlab directory. In my example I have chosen the D:\MountainSortTemp directory. This Windows filepath is different within the WSL so we will have to convert our filename to the appropriate Ubuntu filename. All of the connected Windows drives have their corresponding letters mounted in the /mnt location (confirm by using the cd /mnt command in the Ubuntu terminal). D:\MountainSortTemp will correspond to /mnt/d/MountainSortTemp in Ubuntu, this Ubuntu path is the one we need to use in the configuration.
  4. You will see the following response (to ml-config) stating the name of the config file (at the top), and the directory variables:
    No config file found at: /home/username/conda/envs/mlab/etc/mountainlab/mountainlab.env
    To change this, set either the
    environment variable.
    The following environment variables are being used.
    They can be set in the configuration file (see above),
    although existing environment variables will not be
    overriden by configuration file entries.
    The following are the values actually being used:
    Temporary directory: /tmp/mountainlab-tmp
    Package search directories: /home/username/conda/envs/mlab/etc/mountainlab/packages:/home/username/conda/envs/mlab/lib/node_modules/mountainlab/system-packages
    PRV search directories: /tmp/mountainlab-tmp
    Database directory: /home/username/conda/envs/mlab/etc/mountainlab/database​
    • At the top of the response it says No config file at /home/username/conda/envs/mlab/etc/mountainlab/mountainlab.env therefore we must create it. If the file does exist, the response will state the following Using configuration from: /home/username/conda/envs/mlab/etc/mountainlab/mountainlab.env. Either way, we will modify the ML_TEMPORARY_DIRECTORY variable by using the following command. Note: replace "username" with the appropriate username:
      nano /home/username/conda/envs/mlab/etc/mountainlab/mountainlab.env
    • If you are editing an existing file (that isn't blank), you should see existing text fields. You are looking for the line that says ML_TEMPORARY_DIRECTORY=X. You will replace the X value as shown below:
      • If the file is empty, just type the above text in the file.
      • Save by pressing Ctrl+X, followed by Y, and then Enter.
    • Now when we re-run the ml-config command the response should no longer say that the ML_TEMPORARY_DIRECTORY is set to [default].

Installing Data Visualization Packages

There are two ways to visualize the MountainSort'ed data (that the development team provides).

  1. The first package is ephys-viz, I personally have never used this package as it has been in development. I have attempted to use this package without any luck so I suggest moving onto the second option. If you wish to try ephys-viz,  you can install it by using the following command:
    conda install -c flatiron -c conda-forge ephys-viz
  2. The second package provided is MountainView, which was the legacy GUI used with the older versions of MountainSort. I tend to opt for using this over ephys-viz personally. However, I ultimately convert all the data from MountainSort to a format that I can use with other proprietary data visualization software. You can install MountainView with the use of the following command:
    conda install -c flatiron -c conda-forge qt-mountainview
  3. I also suggest downloading Qt5. I had some errors attempting to use MountainView because I did not download Qt5. You can do so by using the following command:
    sudo apt-get install qtdeclarative5-dev qt5-default qtbase5-dev qtscript5-dev make g++
  4. I received the following error when attempting to use MoutainView: qt-mountainview: error while loading shared libraries: cannot open shared object file: No such file or directory. Therefore, I also suggest you install the libraries using the following command:
    sudo apt-get install libglu1-mesa


  1. MountainSort (JS version) Installation:


Post Comment