Files
object-segmentation/INSTALL_TEST.md

4.8 KiB

Installation Testing Guide

This guide helps you verify that the package installation works correctly.

Clean Installation Test

1. Remove Any Previous Installations

# Deactivate any active virtual environment
deactivate

# Remove old virtual environment (if exists)
rm -rf venv

# Create fresh virtual environment
python3 -m venv venv
source venv/bin/activate  # On Linux/Mac
# or
venv\Scripts\activate  # On Windows

2. Install the Package

Option A: Editable/Development Install

pip install -e .

This allows you to modify source code and see changes immediately.

Option B: Regular Install

pip install .

This installs the package as if it were from PyPI.

3. Verify Installation

# Check package is installed
pip list | grep microscopy

# Check version
microscopy-detect --version
# Expected output: microscopy-object-detection 1.0.0

# Test Python import
python -c "import src; print(src.__version__)"
# Expected output: 1.0.0

4. Test Entry Points

# Test CLI
microscopy-detect --help

# Test GUI launcher (will open window)
microscopy-detect-gui

5. Verify Package Contents

# Run this in Python shell
import src
import src.database
import src.model
import src.gui

# Check schema file is included
from pathlib import Path
import src.database
db_path = Path(src.database.__file__).parent
schema_file = db_path / 'schema.sql'
print(f"Schema file exists: {schema_file.exists()}")
# Expected: Schema file exists: True

Troubleshooting

Issue: ModuleNotFoundError

Error:

ModuleNotFoundError: No module named 'src'

Solution:

# Reinstall with verbose output
pip install -e . -v

# Or try regular install
pip install . --force-reinstall

Issue: Entry Points Not Working

Error:

microscopy-detect: command not found

Solution:

# Check if scripts are in PATH
which microscopy-detect

# If not found, check pip install location
pip show microscopy-object-detection

# You might need to add to PATH or use full path
~/.local/bin/microscopy-detect  # Linux

Issue: Import Errors for PySide6

Error:

ImportError: cannot import name 'QApplication' from 'PySide6.QtWidgets'

Solution:

# Install Qt dependencies (Linux only)
sudo apt-get install libxcb-xinerama0

# Reinstall PySide6
pip uninstall PySide6
pip install PySide6

Issue: Config Files Not Found

Error:

FileNotFoundError: config/app_config.yaml

Solution: The config file should be created automatically. If not:

# Create config directory in your home
mkdir -p ~/.microscopy-detect
cp config/app_config.yaml ~/.microscopy-detect/

# Or run from source directory first time
cd /home/martin/code/object_detection
python main.py

Manual Testing Checklist

  • Package installs without errors
  • Version command works (microscopy-detect --version)
  • Help command works (microscopy-detect --help)
  • GUI launches (microscopy-detect-gui)
  • Can import all modules in Python
  • Database schema file is accessible
  • Configuration loads correctly

Build and Install from Wheel

# Build the package
python -m build

# Install from wheel
pip install dist/microscopy_object_detection-1.0.0-py3-none-any.whl

# Test
microscopy-detect --version

Uninstall

pip uninstall microscopy-object-detection

Development Workflow

After Code Changes

If installed with -e (editable mode):

  • Python code changes are immediately available
  • No need to reinstall

If installed with regular pip install .:

  • Reinstall after changes: pip install . --force-reinstall

After Adding New Files

# Reinstall to include new files
pip install -e . --force-reinstall

Expected Installation Output

Processing /home/martin/code/object_detection
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: microscopy-object-detection
  Building wheel for microscopy-object-detection (pyproject.toml) ... done
Successfully built microscopy-object-detection
Installing collected packages: microscopy-object-detection
Successfully installed microscopy-object-detection-1.0.0

Success Criteria

Installation is successful when:

  1. No error messages during installation
  2. pip list shows the package
  3. microscopy-detect --version returns correct version
  4. GUI launches without errors
  5. All Python modules can be imported
  6. Database operations work
  7. Detection functionality works

Next Steps After Successful Install

  1. Configure image repository path
  2. Run first detection
  3. Train a custom model
  4. Export results

For usage instructions, see QUICKSTART.md