Troubleshooting Guide
This guide helps you diagnose and fix common issues with the Raman Spectroscopy Analysis Application.
Quick Diagnostic Steps
Before diving into specific issues:
Check the logs
Location:
logs/folder in project directoryKey files:
application.log,PreprocessPage.log,RamanPipeline.log
Verify installation
python -c "import PySide6; print('PySide6 OK')" python -c "import ramanspy; print('RamanSPy OK')"
Update to latest version
git pull origin main uv pip install -e .
Check system resources
RAM usage (Task Manager / Activity Monitor)
Disk space (>500 MB free recommended)
CPU usage
Installation Issues
Python Version Error
Error: Python 3.12 or higher is required
Diagnosis:
python --version
Solution:
Install Python 3.12+ from python.org
On Windows, check “Add Python to PATH” during installation
Verify installation:
python --versionReinstall dependencies:
uv pip install -e .
Module Not Found
Error: ModuleNotFoundError: No module named 'PySide6' (or other modules)
Diagnosis:
Check if virtual environment is activated
Verify dependencies are installed
Solution:
# Ensure virtual environment is activated
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
# Reinstall dependencies
uv pip install -e .
# OR
pip install -r requirements.txt
# Verify installation
python -c "import PySide6; print('OK')"
UV Installation Fails
Error: pip install uv fails or UV commands don’t work
Solution: Use traditional virtual environment instead:
# Create venv
python -m venv .venv
# Activate
.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS/Linux
# Install dependencies
pip install -r requirements.txt
# Run application
python main.py
Permission Denied (Linux/macOS)
Error: PermissionError: [Errno 13] Permission denied
Cause: Trying to install globally without sudo (bad practice)
Solution:
# Never use sudo with pip in virtual environments
# Instead, activate virtual environment first:
source .venv/bin/activate
# Then install normally
pip install -r requirements.txt
Windows SmartScreen Blocks Executable
Warning: “Windows protected your PC” when running executable
Solution:
Click More info
Click Run anyway
Why this happens: The executable is not digitally signed (requires expensive code signing certificate). The software is safe to run.
Alternative: Run from source using Python to avoid this warning.
Application Launch Issues
Application Doesn’t Start
Symptoms: Double-click executable or run python main.py - nothing happens
Diagnosis:
# Run with verbose logging
python main.py --verbose
# Check logs
cat logs/application.log # macOS/Linux
type logs\application.log # Windows
Common causes:
Missing configuration files
Check
configs/app_configs.jsonexistsIf missing, application will create default on first run
Port conflict
Check if another instance is running
Close duplicate instances
Graphics driver issue
Update graphics drivers
Try software rendering:
export QT_QPA_PLATFORM=offscreen(Linux)
Application Crashes on Startup
Error: Immediate crash or “Segmentation fault”
Diagnosis:
Look for error in logs/application.log
Solutions by error type:
Qt Platform Error:
# Linux: Install required Qt libraries
sudo apt-get install libxcb-xinerama0 libxcb-cursor0
# macOS: Reinstall PySide6
pip uninstall PySide6
pip install PySide6
OpenGL Error:
# Use software rendering (Linux)
export QT_QPA_PLATFORM=offscreen
# Or force specific Qt backend
export QT_QPA_PLATFORM=xcb
Font Error:
# Install font packages
# Linux:
sudo apt-get install fonts-noto fonts-noto-cjk
# macOS: Fonts should be included
Black/Blank Window
Symptoms: Application opens but window is completely black or blank
Causes:
Graphics driver incompatibility
High DPI scaling issues
Qt platform plugin issues
Solutions:
Try software rendering:
# Linux
export QT_QPA_PLATFORM=xcb
python main.py
# Windows
set QT_QPA_PLATFORM=windows
python main.py
Adjust DPI scaling (Windows):
Right-click application → Properties
Compatibility tab
Check “Override high DPI scaling behavior”
Select “Application” from dropdown
Update graphics drivers:
NVIDIA: GeForce Experience
AMD: Radeon Software
Intel: Intel Driver & Support Assistant
Data Import Issues
File Not Recognized
Error: “Unable to read file” or “Unsupported file format”
Diagnosis:
Check file extension (.csv, .txt, .asc, .ascii, .pkl)
Open file in text editor to inspect structure
Solutions:
For CSV/TXT files:
Ensure proper delimiter (comma for CSV, tab for TXT)
Remove non-numeric data (text annotations, units)
Verify first row/column structure
For ASC/ASCII files:
Ensure the file contains two numeric columns: wavenumber and intensity
Ensure a consistent delimiter (space, tab, or comma)
For PKL files:
Ensure the file was created by pandas (
DataFrame.to_pickle)Ensure it contains a DataFrame with wavenumbers as the index
Working CSV example:
Wavenumber,Spectrum1,Spectrum2
400,125.3,134.2
401,126.1,135.4
402,127.3,136.8
Dimension Mismatch Error
Error: “Shape mismatch” or “Dimension error”
Cause: Not all spectra have same wavenumber range
Diagnosis: Check each file:
import pandas as pd
df1 = pd.read_csv('file1.csv')
df2 = pd.read_csv('file2.csv')
print(df1.shape, df2.shape) # Should be same
Solution:
Ensure all spectra have identical wavenumber range
Use interpolation if ranges differ slightly:
Preprocessing → Interpolation → Select common range
Data Looks Wrong After Import
Symptoms: Spectra inverted, flipped, or nonsensical
Diagnosis:
Check if wavenumber values are in rows or columns
Verify intensity values are positive
Look for missing data (NaN, null values)
Solution:
Transpose data if needed:
Data Package → Select dataset → Transpose
Handle missing values:
Replace NaN with zeros or interpolate
Or remove affected spectra
Check wavenumber order:
Should be ascending (400 → 1800) or descending (1800 → 400)
Use Reverse Wavenumber Axis if needed
Preprocessing Issues
Preview Shows All Zeros
Symptoms: After adding preprocessing step, preview is blank or all zeros
Causes:
Parameter out of valid range
Input data incompatible with method
Method requires positive intensities (has negatives)
Diagnosis:
Check console/log for error messages
Try with default parameters
Preview intermediate steps
Solutions:
Reset parameters to defaults:
Click parameter label to reset
Check input data:
Ensure baseline correction is done first
Verify no negative intensities
Try different method:
If AsLS fails, try AirPLS
If method-specific, use alternative
Baseline Correction Not Working
Symptoms: Fluorescence background still present after baseline correction
Diagnosis: Check preview - is baseline slightly improved or completely unchanged?
Solutions:
If slightly improved:
Increase lambda parameter (try 1e7, 1e8)
Try different method (AirPLS instead of AsLS)
If completely unchanged:
Check that method is actually applied (green checkmark)
Verify input data is loaded
Try simpler method (Polynomial baseline)
For strong fluorescence:
Method: AirPLS
Lambda: 1e6 or higher
Max Iterations: 50
Smoothing Removes Peaks
Symptoms: Important peaks disappear after smoothing
Cause: Window size too large
Solution: Reduce smoothing window:
For sharp peaks: window = 5
For normal peaks: window = 7-11
For broad peaks: window = 11-15
Rule: Window must be odd number and smaller than peak width.
Normalization Produces Strange Results
Symptoms: Spectra become extremely small/large or unrecognizable
Causes:
Baseline not removed first
Negative intensities present
Wrong normalization method for data type
Solutions:
Always baseline correct before normalizing
Use appropriate normalization:
Vector: Most Raman data
SNV: Biological samples
Min-Max: When absolute intensities matter
Area: For quantitative comparisons
Remove negative values:
Add offset: minimum value + small epsilon
Or use ReLU: replace negatives with 0
Pipeline Fails to Execute
Error: “Pipeline execution failed” or individual steps fail
Diagnosis:
Check which step fails (look at step number in error)
Verify parameters for that step
Test step individually
Common issues:
Step order wrong:
Baseline → Smoothing → Normalization
Never normalize before baseline
Incompatible steps:
Some methods require specific input ranges
Check method documentation
Resource exhaustion:
Too many spectra for available RAM
Process in smaller batches
Solution:
Test each step individually
Check parameter constraints
Reduce batch size if memory issue
Analysis Issues
PCA Shows No Group Separation
Symptoms: All groups overlap in PCA plot
NOT necessarily an error! This may indicate:
Groups are genuinely similar
Preprocessing removes discriminative features
Variance is in other components (PC3, PC4)
Diagnosis checklist:
Baseline correction applied?
Normalization applied?
Outliers removed?
Checked PC2 vs PC3 plot?
Examined scree plot (variance explained)?
Solutions:
Try supervised method:
Use PLS-DA instead of PCA
PLS-DA maximizes group separation
Improve preprocessing:
Ensure baseline is fully removed
Try different normalization (SNV vs Vector)
Add cosmic ray removal
Check other components:
Plot PC2 vs PC3
Look for separation in higher PCs
Remove outliers:
Use outlier detection
Remove spectra with poor quality
Consider reality:
Groups may actually be similar
Small effect size requires larger sample
Statistical Tests Show No Significant Differences
Symptoms: All p-values > 0.05, no significant regions
Possible causes:
Small sample size (low statistical power)
High variability within groups
Groups are actually similar
Overly strict correction (Bonferroni)
Solutions:
Check sample size:
Need n ≥ 5 per group minimum
n ≥ 10 per group recommended
Increase sample size if possible
Use appropriate test:
Mann-Whitney for non-normal data
Use less conservative correction (FDR instead of Bonferroni)
Check effect size:
Even non-significant p-values can have large effect sizes
Report Cohen’s d or similar
Explore data:
Use PCA to visualize
Check if differences exist at all
Analysis Takes Forever
Symptoms: Analysis runs for >5 minutes without completing
Causes:
Large dataset (>1000 spectra)
Computationally intensive method (UMAP, t-SNE)
Too many cross-validation folds
Solutions:
Reduce data size:
Use subset for testing parameters
Then run full analysis overnight
Optimize parameters:
UMAP/t-SNE: Reduce n_neighbors, n_iterations
Clustering: Subsample data
Use faster alternative:
PCA instead of UMAP for quick exploration
Random sample for preview
Increase CPU usage:
Settings → Processing → CPU Cores: Set to max
Plots Don’t Appear
Symptoms: Analysis completes but no plots shown
Diagnosis:
Check if results tab is created
Look for error in console
Try exporting results (might show even if not displayed)
Solutions:
Check matplotlib backend:
import matplotlib print(matplotlib.get_backend()) # Should be Qt5Agg or similar
Try refreshing:
Switch to different tab and back
Close and reopen results panel
Export and view externally:
Use Export Results button
Open saved PNG files
Reinstall matplotlib:
pip uninstall matplotlib pip install matplotlib
Machine Learning Issues
Model Training Fails
Error: “Training failed” or crash during training
Common causes:
Insufficient data:
Need at least 20 samples per class
Use simpler model or collect more data
NaN/Inf in features:
Check preprocessing produces valid numbers
Remove or impute missing values
Memory error:
Reduce dataset size
Use simpler model
Close other applications
Solutions:
Start simple:
Use Logistic Regression first
If works, try more complex models
Check data quality:
# Check for NaN import numpy as np print(np.isnan(data).any()) # Check for Inf print(np.isinf(data).any())
Reduce complexity:
Fewer cross-validation folds (3 instead of 5)
Smaller grid search space
Simpler model architecture
100% Training Accuracy, Poor Test Accuracy
Symptoms: Training accuracy = 100%, test accuracy = 50-70%
Diagnosis: Classic overfitting
Solutions:
Simplify model:
Random Forest: Reduce max_depth
XGBoost: Increase reg_alpha, reg_lambda
Neural Network: Reduce layers/neurons
Increase regularization:
SVM: Reduce C parameter
Logistic Regression: Increase penalty
Collect more data:
More samples reduces overfitting
Aim for 50+ samples per class
Feature selection:
Use only most important features
Reduces model complexity
Ensemble methods:
Use Random Forest (naturally regularized)
Averaging reduces overfitting
Groups Imbalanced (90% vs 10%)
Symptoms: Model always predicts majority class
Solutions:
Use stratified sampling:
Ensures both classes in train/test
Already default in application
Use appropriate metrics:
NOT accuracy (misleading)
Use ROC-AUC, F1-score, balanced accuracy
Class weighting:
Set
class_weight='balanced'in model parametersPenalizes misclassifying minority class more
Resampling:
Oversample minority class (SMOTE)
Undersample majority class
Or both (SMOTEENN)
Threshold adjustment:
Default threshold = 0.5
Adjust based on ROC curve
Optimize F1-score
SHAP Values Take Forever
Symptoms: SHAP interpretation runs for >30 minutes
Cause: SHAP is computationally expensive, especially for tree models
Solutions:
Use subset:
Calculate SHAP for 100 samples only
Still provides good interpretation
Use TreeExplainer:
Faster for tree-based models (RF, XGBoost)
Automatically used when available
Use KernelExplainer (last resort):
Model-agnostic but slow
Use smallest possible sample
Alternative: Permutation Importance:
Much faster
Less detailed but still useful
Can’t Export Trained Model
Error: Export fails or file not created
Diagnosis:
Check write permissions on output folder
Verify model training completed successfully
Look for error message
Solutions:
Check folder permissions:
Ensure you can write to selected folder
Try different location (Desktop, Documents)
Check model size:
Large models (>2GB) may fail
Use simpler model or feature selection
Try different format:
Default: pickle (.pkl)
Alternative: ONNX (.onnx) - more portable
Performance Issues
Application Runs Slowly
General performance optimization:
Close other applications:
Free up RAM and CPU
Especially other Python applications
Reduce CPU usage:
Settings → Processing → CPU Cores
Set to
max - 1to keep system responsive
Process smaller batches:
Split large datasets into smaller groups
Process sequentially
Disable real-time preview:
Preview requires continuous computation
Disable while building pipeline
Update Python and libraries:
pip install --upgrade pip pip install --upgrade numpy scipy scikit-learn
High RAM Usage
Symptoms: Application uses >4 GB RAM or crashes with “MemoryError”
Solutions:
Process fewer spectra at once:
Split dataset into batches of 100-500 spectra
Process and save each batch
Reduce data precision:
Convert float64 to float32 (half memory)
Acceptable for most analyses
Close unused results:
Each analysis result keeps figures in memory
Close old results before starting new analyses
Restart application periodically:
Memory leaks may accumulate
Restart after several hours of use
Disk Space Issues
Symptoms: “No space left on device” or save operations fail
Diagnosis:
# Check disk space
df -h # Linux/macOS
wmic logicaldisk get size,freespace # Windows
Solutions:
Clean up old projects:
Delete or archive completed projects
Projects can be large (>1 GB with results)
Clear logs:
Delete old log files in
logs/folderKeep only recent logs
Export and delete results:
Export important results (figures, data)
Delete from application
Move projects to external drive:
Projects are portable
Move entire project folder
UI Issues
Text Too Small/Large
Cause: High DPI scaling on Windows
Solution:
Settings → Interface → Font Size
Choose: Small, Medium, Large, Extra Large
Restart application
Windows scaling issue:
Right-click application → Properties → Compatibility
Check “Override high DPI scaling behavior”
Select “Application”
Japanese Text Shows as Boxes (□□□)
Cause: Missing Japanese font
Solutions:
Windows:
Control Panel → Fonts
Ensure “MS Gothic” or “Meiryo” is installed
If missing, install from Windows Features
macOS:
Usually includes Japanese fonts by default
If issue persists, install “Hiragino Sans”
Linux:
sudo apt-get install fonts-noto-cjk
Then restart application.
Getting More Help
Collect Diagnostic Information
When reporting issues, include:
System information:
python --version pip list > installed_packages.txt
Error logs:
Attach
logs/application.logInclude error traceback
Screenshots:
Show the issue visually
Include error messages
Steps to reproduce:
Detailed step-by-step
Sample data if possible
Where to Get Help
Search documentation:
Search existing issues:
Many problems already solved
Ask community:
Other users may have encountered same issue
Report bug:
Include diagnostic information
Contact developer:
For complex issues
Emergency: Application Completely Broken
Nuclear option - Full reinstall:
# 1. Backup your projects folder
cp -r projects/ /backup/location/
# 2. Remove application completely
rm -rf .venv/
rm -rf logs/
rm -rf __pycache__/
# 3. Fresh install
git pull origin main
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txt
# 4. Test with simple operation
python main.py
# 5. Restore projects
cp -r /backup/location/projects/ ./
This should resolve almost any installation corruption issue.
Contributing to This Guide
Found a solution not listed here?
Fork the repository
Edit
docs/troubleshooting.mdAdd your solution with clear title, diagnosis, and solution steps
Submit pull request
Help others avoid the same issues you faced!