Setting up the SMappe (Python) on Linux

SMapper installation instructions

Below are the installation instructions for SMapper software, along with the necessary prerequisites and dependencies:

Prerequisites:

  • Linux (Ubuntu) operating system
  • Anaconda package manager
    Conda is an open-source package and environment management system that runs on Windows, macOS, and Linux. Conda quickly installs, runs, and updates packages and their dependencies. It also easily creates, saves, loads, and switches between environments on your local computer. It was created for Python programs.
  • Ttkwidgets 0.13.0
    A collection of widgets for Tkinter's ttk extensions by various authors
  • Cartopy 0.21.1
    Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy.
  • GeoPandas 0.13.2
    GeoPandas is an open source project to make working with geospatial data in python easier. GeoPandas extends the datatypes used by pandas to allow spatial operations on geometric types. Geometric operations are performed by shapely. Geopandas further depends on fiona for file access and matplotlib for plotting.
  • Reportlab 3.6.12

To install the SMapper Tool on your Linux (Ubuntu) distribution, we have included a smapper_setup shell script and an smapper_environment.yml file within the SMapper Python Scripts Version 5.0 for installation purposes.

1. Installation using Shell and YML

1.1 Conda Installation on your Linux (Ubuntu)

After downloading the SMapper Python Scripts as a zip file and extracting its contents, you will find two files: smapper_setup.sh and smapper_environment.yml.

To proceed, grant execution permissions to the smapper_setup.sh file by executing the following command in the command line:

chmod +x smapper_setup.sh

Afterward, you can run it by executing:

./smapper_setup.sh

Please follow the instructions, close your terminal session, and then reopen it.

Note: The 'gcc' compiler is needed to build some of the dependencies, including the 'cartopy' package. If you're using a Linux distribution, you can use the following command:

sudo apt-get install build-essential

1.2 Creating the SMapper Environment from the YAML file

Please open the smapper_environment.yml file, and if necessary, adjust the prefix according to your Conda installation path.

Note: Instructions on adjusting the 'prefix' in the smapper_environment.yml file. READ MORE

Please note that the "prefix" in the smapper_environment.yml file specifies the path where the Conda environment will be created when you use the "conda env create" command. Typically, this path is defined as a relative or absolute file system path to the directory where you want the environment to be located.

If you wish to change the location of the environment during recreation, you can specify a new "prefix" in the smapper_environment.yml file.

For instance:
prefix: /path/to/new/environment/location

Simply replace /path/to/new/environment/location with the desired directory path where you want the environment to be created when you execute "conda env create -f environment.yml."

The prefix in your environment.yml file specifies the path where the Conda environment will be created. In this case, the prefix is set to /home/ubuntu/anaconda/envs/geo_env. This means that when you create a new environment from this YAML file using conda env create -f smapper_environment.yml, it will generate the "geo_env" Conda environment at that specific location.

Thus, the defined prefix indicates that the "geo_env" environment will be created in the directory /home/ubuntu/anaconda/envs/geo_env. This is a useful feature if you want to specify a particular location for your Conda environment.

Update Conda on the base environment:

conda update -n base -c defaults conda

Now, you can create a new "geo_env" environment from the smapper_environment.yml file:

conda env create -f smapper_environment.yml

Note: You may need to install the new fonts for Tkinter on your system.

conda install -c conda-forge tk=*=xft_*

Afterward, you can activate the "geo_env" environment:

conda activate geo_env

Finally, you can start SMapper:

python main.py

This will launch the tool, and you can start testing it.

We'd like to present the options for a complete, step-by-step installation of an SMapper environment.

2. Complete Manual Installation of All Packages

If you'd rather, you have the option to manually install all the packages. Please click here to view the step-by-step instructions.

To set up your Linux distribution for the use of SMapper-Tool, please follow these steps:

  1. Install the Anaconda package manager by following these steps:

    • Go to the following website: Anaconda Individual Edition
    • Download the installer for your Linux distribution.
    • Open the terminal and navigate to the directory where the installer was downloaded.
    • Run the following command to start the installation:
      bash Anaconda3-2022.10-Linux-x86_64.sh
    • Follow the prompts and accept the license agreement to complete the installation.
    • After the installation finishes, add Anaconda to your system's PATH by running the following command:
      echo 'export PATH="/home/username/anaconda3/bin:$PATH"' >> ~/.bashrc

      Note: Change the "/home/username" directory to your directory.

    • Close the terminal and open a new one to apply the changes.
  2. Update Conda:

    Open a terminal and run the following command:
    conda update -n base -c defaults conda
  3. Install Geopandas in a newly created environment:

    Open a terminal and run the following commands one by one:
    conda create -n geo_env
    conda activate geo_env
    conda config --env --add channels conda-forge
    conda config --env --set channel_priority strict
    conda install python=3.9 geopandas
    
  4. Install Ttkwidgets:

    You need to install the package "ttkwidgets" in your conda environment "geo_env".

    Note: Activate the Conda Environment “geo_env” beforehand.

    conda activate geo_env
    Assuming your "geo_env" environment is currently enabled, you can install ttkwidgets using Conda with the following command:
    conda install -c gagphil1 ttkwidgets

    Note: You may need to install the new fonts for Tkinter on your system.

    conda install -c conda-forge tk=*=xft_*
  5. Install Cartopy:

    You need to install the package "Cartopy" in your conda environment "geo_env". Open a terminal and run the following command:
    conda install -c conda-forge cartopy
  6. Install reportlab:

    Open a terminal and run the following command:
    conda install -c conda-forge reportlab
  7. Install pillow:

    Open a terminal and run the following command:
    conda install -c conda-forge pillow

Once you have completed the installation steps, you can run the tool by following these instructions:

  1. Open a command-line window and navigate to the main folder that contains the main.py file.

  2. If you haven't already done so, activate the environment created earlier by running the following command:

    conda activate geo_env
  3. Run the tool using Python by executing the following command:

    python main.py

This will launch the tool, and you can start testing it. If you encounter any questions or problems during the setup process, please contact us via email at support-smapper(at)uni-koeln.de.

Please note that the SMapper software has been tested with Python version 3.9. Depending on your existing or new Python, Anaconda version, and other OS platforms, there may be conflicts or unavailability of certain packages.

If you need further assistance, please contact us at support-smapper(at)uni-koeln.de


Last updated: October 11, 2024 | SMapper Version 5.0 | ©CCG - Statistical Genetics and Bioinformatics Group