graph-tool

 

About

This page provides instructions for installing graph-tool

It was tested for

graph-tool/2.4.

The instructions below will install graph-tool in a Conda environment which in this example is called gt. The instructions are based on https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#conda

For more information on using conda on ALICE and SHARK, see Installing Python packages - Conda

If you notice any issues, please let us know.

ALICE

ALICE has two system-wide software stacks, i.e., one for nodes with Intel CPUs and one for nodes with AMD CPUs.

Because the login nodes have Intel CPUs, installing software for AMD nodes works slightly different.

Intel nodes

  • Make sure that you have a clean module environment

  • You can either copy the commands or safe them in a shell script and execute them

    • The instructions assume that you have already used conda once and initialised it.

  • You can run the instructions on the login nodes

  • Adjust the path (line 9) as needed

#!/bin/bash module purge module load ALICE/default module load Miniconda3/4.9.2 source ~/.bashrc # Set the path as needed venv_path='/path/to/gt' ############################ # Commands below should work # without modifications ############################ # Create virtual environment conda create -y --prefix $venv_path -c conda-forge graph-tool # Source the virtual environment conda activate $venv_path # Test it # very basic test only python -c "from graph_tool.all import *; g = Graph(); v1 = g.add_vertex(); v2 = g.add_vertex(); e = g.add_edge(v1, v2); print(v1.out_degree())"

AMD nodes

  • Save the commands below in a file (e.g., install_graphtool_amd.slurm that can be submitted to slurm using sbatch install_graphtool_amd.slurm

    • Running the batch job might only work if you have already used conda once.

    • Alternatively, create an interactive job with salloc, ssh to the allocated node and install everything manually. Make sure that you start from a clean module environment.

  • Adjust the path (line 15) as needed:

#!/bin/bash #SBATCH --job-name=install_graphtool_amd #SBATCH --output=%x_%j.out #SBATCH --partition="amd-short" #SBATCH --time=00:15:00 #SBATCH --ntasks=1 #SBATCH --mem=1G module load ALICE/default module load Miniconda3/4.9.2 source ~/.bashrc # Adjust path the path as needed venv_path='/path/to/gt' ############################ # Commands below should work # without modifications ############################ if [ -d $venv_path ]; then echo "#### Virtual environment $venv_path already exists. Continuing" else echo "#### Creating virtual environment $venv_path" conda create -y --prefix $venv_path -c conda-forge graph-tool fi echo "#### Switching to conda env" conda activate $venv_path # very basic test echo "#### Testing" python -c "from graph_tool.all import *; g = Graph(); v1 = g.add_vertex(); v2 = g.add_vertex(); e = g.add_edge(v1, v2); print(v1.out_degree())" echo "#### Done"

Make sure to check the slurm output file for any error messages.

SHARK

  • Make sure that you have a clean module environment

  • You can either copy the commands or safe them in a shell script and execute them

    • The instructions assume that you have already used conda once and initialised it.

  • You can run the instructions on the login nodes

  • Adjust the path (line 8) as needed

#!/bin/bash module purge module load tools/miniconda/python3.9/4.12.0 source ~/.bashrc # Set the path as needed venv_path='/path/to/gt' ############################ # Commands below should work # without modifications ############################ # Create virtual environment conda create -y --prefix $venv_path -c conda-forge graph-tool # Source the virtual environment conda activate $venv_path # Test it # very basic test only python -c "from graph_tool.all import *; g = Graph(); v1 = g.add_vertex(); v2 = g.add_vertex(); e = g.add_edge(v1, v2); print(v1.out_degree())"