Installation

MedTDA can be installed via pip or from source. This guide covers all installation methods and common troubleshooting steps.

Install from PyPI

The simplest way to install MedTDA is using pip:

pip install medtda

This will install MedTDA and its core dependencies.

Requirements

Python Version

MedTDA requires Python 3.10 or later. Check your Python version:

python --version

Core Dependencies

The following packages are automatically installed with Med-TDA:

  • NumPy (≥1.21.0) - Numerical computing and array operations

  • SciPy (≥1.7.0) - Scientific computing and optimization

  • GUDHI (≥3.5.0) - Persistent homology computation

  • cripser (≥0.0.32) - Fast cubical complex persistence

  • SimpleITK (≥2.1.0) - Medical image I/O and processing (NIfTI, NRRD, MHA, MHD)

  • Pillow (≥9.0.0) - 2D image I/O (PNG, JPG, TIFF)

  • scikit-image (≥0.19.0) - Image processing algorithms

  • scikit-learn (≥1.0.0) - Machine learning utilities and preprocessing

  • pandas (≥1.3.0) - Data manipulation and CSV handling

  • matplotlib (≥3.5.0) - Plotting and visualization

  • seaborn (≥0.11.0) - Statistical data visualization

  • PyYAML (≥6.0) - Configuration file support

  • tqdm (≥4.60.0) - Progress bars for CLI

All of these dependencies will be installed automatically when you install Med-TDA via pip.

Install from Source

For the latest development version or to contribute to Med-TDA:

# Clone the repository
git clone https://github.com/dashtiali/medtda.git
cd medtda

# Install in development mode
pip install -e .

Development Installation

If you plan to contribute or run tests:

# Clone repository
git clone https://github.com/dashtiali/medtda.git
cd medtda

# Install in development mode with dev dependencies
pip install -e .[dev]

This installs additional packages for testing and documentation:

  • pytest

  • pytest-cov

  • sphinx

  • sphinx-rtd-theme

  • nbsphinx

Verify Installation

Check that MedTDA is installed correctly:

import medtda
print(medtda.__version__)

Run a quick test:

from medtda import FeatureExtractor
import numpy as np

# Create a simple test image
image = np.random.rand(50, 50)

# Initialize extractor
extractor = FeatureExtractor(vectorization_method='PersStats')

# Extract features (should run without errors)
features = extractor.execute(image)
print(f"Successfully extracted {len(features)} features")

Troubleshooting

Common Issues

ImportError: No module named ‘medtda’

Solution: Make sure pip installation completed successfully and you’re using the correct Python environment.

# Check if medtda is installed
pip list | grep medtda

# Reinstall if necessary
pip install --upgrade medtda

ImportError: No module named ‘SimpleITK’

Solution: Install SimpleITK for 3D/4D medical image support:

pip install SimpleITK

GUDHI or cripser installation fails

Solution: These packages may require compilation. Try:

# Install from conda-forge (if using conda)
conda install -c conda-forge gudhi

# Or upgrade pip and try again
pip install --upgrade pip
pip install gudhi cripser

Memory errors during installation

Solution: Install packages individually if you have limited RAM:

pip install numpy
pip install gudhi
pip install cripser
pip install scikit-learn
pip install medtda --no-deps
pip install medtda  # Install remaining dependencies

Platform-Specific Notes

Windows

  • Use Anaconda/Miniconda for easier dependency management

  • Visual C++ build tools may be required for some dependencies

macOS

  • Xcode Command Line Tools may be required:

    xcode-select --install
    

Linux

  • GCC compiler required for some dependencies

  • Ubuntu/Debian:

    sudo apt-get update
    sudo apt-get install build-essential python3-dev
    
  • CentOS/RHEL:

    sudo yum groupinstall "Development Tools"
    sudo yum install python3-devel
    

Virtual Environments

It’s recommended to use a virtual environment:

Using venv

# Create virtual environment
python -m venv medtda-env

# Activate (Linux/macOS)
source medtda-env/bin/activate

# Activate (Windows)
medtda-env\Scripts\activate

# Install MedTDA
pip install medtda

Using conda

# Create conda environment
conda create -n medtda python=3.10
conda activate medtda

# Install dependencies from conda-forge
conda install -c conda-forge numpy gudhi scikit-learn pyyaml tqdm

# Install MedTDA
pip install medtda

Updating MedTDA

To update to the latest version:

pip install --upgrade medtda

To update to a specific version:

pip install medtda==0.2.0

Uninstallation

To remove MedTDA:

pip uninstall medtda

Next Steps