Troubleshooting Guide

Common issues and solutions for the ML Playground guides.

← Back to ML Playground

1. Setup Issues

"Python not found" or "python is not recognized"

Python is not installed or not in your system PATH.

  • Recommended: Install Anaconda, which bundles Python, Jupyter, pandas, scikit-learn, and other packages the guides need.
  • Windows: After installing Anaconda, open Anaconda Prompt from the Start Menu instead of Command Prompt.
  • macOS/Linux: If you installed Python via Homebrew or your package manager, try python3 instead of python.
  • Verify: Run python --version (or python3 --version). You should see Python 3.8 or later.

pip install fails or "pip: command not found"

  • Try pip3 install ... instead of pip install ...
  • If you get permission errors, add --user: pip install --user pandas scikit-learn
  • Best practice: Use a virtual environment to avoid conflicts:
    python -m venv ml-playground-env # Windows: ml-playground-env\Scripts\activate # macOS/Linux: source ml-playground-env/bin/activate pip install pandas numpy matplotlib seaborn scikit-learn xgboost lightgbm

Jupyter won't start

  • Install JupyterLab: pip install jupyterlab
  • If you see a port conflict error, specify a different port: jupyter lab --port 8889
  • Alternatively, use Google Colab in your browser — no local install needed.

ModuleNotFoundError: No module named 'demo_data'

You must run scripts from the repository root directory (the folder containing the demo_data/ folder).

# Check your current directory import os print(os.getcwd()) # If needed, change to the repo root os.chdir("/path/to/Dynamic-Network-Model") # Or add it to sys.path import sys sys.path.insert(0, "/path/to/Dynamic-Network-Model")

2. Data Loading Issues

FileNotFoundError for CSV files

  • Verify you cloned the full repository: git clone https://github.com/SGridworks/Dynamic-Network-Model.git
  • Check your working directory:
    import os print(os.getcwd()) print(os.listdir("demo_data"))
  • Make sure you're running from the repo root, not from a subdirectory.

KeyError on column name

Column names were recently updated for clarity. If you see a KeyError like KeyError: 'rated_kva' or KeyError: 'start_time', you may have an older version of the code or data.

  • Pull the latest version: git pull origin main
  • Updated column names:
    • rated_kvakva_rating (transformers.csv)
    • causecause_code (outage_history.csv)
    • start_timefault_detected (outage_history.csv)
    • end_timeservice_restored (outage_history.csv)
    • customers_affectedaffected_customers (outage_history.csv)

MemoryError loading data

The customer_interval_data.csv file is large (~605 MB uncompressed). For testing and development, load a subset:

from demo_data.load_demo_data import load_customer_interval_data # Load only the first 10,000 rows for testing interval_data = load_customer_interval_data(nrows=10000)

3. Guide-Specific Issues

Guide 03: "OpenDSS not found"

OpenDSS is an optional dependency for the full power flow analysis in Guide 03 (Hosting Capacity).

  • Install it: pip install opendssdirect.py
  • Note: OpenDSS is only available on Windows and Linux, not macOS. On macOS, use the simplified screening method provided in the guide (no OpenDSS needed).
  • The guide's test script will skip the OpenDSS section if it's not installed and still validate the rest.

Guide 06: Q-learning not converging

The reinforcement learning model in Guide 06 (Volt-VAR Optimization) can be sensitive to hyperparameters.

  • Check the epsilon decay rate — if it decays too fast, the agent won't explore enough. Try epsilon_decay = 0.995 instead of 0.99.
  • Increase training episodes to at least 500–1000.
  • Verify the reward function rewards voltage within bounds and penalizes out-of-range values.

Guide 10: LSTM/TensorFlow crash

TensorFlow can have environment issues on some systems, especially Apple Silicon Macs or older GPUs.

  • Recommended: Use the XGBoost alternative provided in the guide — it produces comparable results without TensorFlow dependencies.
  • If you want TensorFlow: pip install tensorflow (for Apple Silicon: pip install tensorflow-macos tensorflow-metal)
  • Set TF_CPP_MIN_LOG_LEVEL=2 to suppress warnings: import os; os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

4. General Tips

Quick setup check: Run this command first to verify everything is working:

python -c "from demo_data.load_demo_data import summary; summary()"
  • Stay updated: Run git pull regularly to get the latest fixes and data updates.
  • Start simple: If a guide isn't working, try running just the first 2–3 code blocks to isolate where the issue occurs.
  • Check Python version: All guides require Python 3.8+. Some advanced guides work best with Python 3.10+.
  • Use Google Colab: If local setup is frustrating, look for the "Open in Colab" button at the top of each guide to run everything in your browser.
  • File an issue: If you're stuck, open an issue on GitHub with the error message, your Python version, and your operating system.
← Back to ML Playground