Principle:Sktime Pytorch forecasting Dependency Diagnostics
| Knowledge Sources | |
|---|---|
| Domains | Time_Series, Forecasting, Deep_Learning, Utilities, DevOps |
| Last Updated | 2026-02-08 09:00 GMT |
Overview
A diagnostic utility for reporting system information and installed dependency versions, designed to aid debugging of environment issues and to provide standardized environment snapshots for bug reports. Adapted from scikit-learn's and sktime's show_versions utilities.
Description
The dependency diagnostics module provides a show_versions function that pretty-prints a summary of the runtime environment, including Python version, executable path, operating system, and the installed versions of all key pytorch-forecasting dependencies. This information is essential for reproducing issues, diagnosing version conflicts, and providing context in bug reports.
The module is organized into three components:
System Information (_get_sys_info): Collects core system details including the Python version string, the path to the Python executable, and the platform identifier (OS name, version, and architecture). This information helps identify environment-level differences that may affect behavior.
Dependency Version Retrieval (_get_deps_info): Retrieves version strings for a specified list of packages. It supports two source modes:
- distributions mode (default) -- Uses importlib distributions via skbase's _get_installed_packages helper. Package names are expected in PEP 440 format (e.g., scikit-learn rather than sklearn). An alias mapping handles common name discrepancies.
- import mode -- Directly imports each module and reads its __version__ attribute. This mode uses import-style names (e.g., sklearn).
Packages that are not installed return None as their version.
Default Dependencies (DEFAULT_DEPS_TO_SHOW): A curated list of packages that are checked by default when show_versions is called. This list covers the full dependency tree: pip, pytorch-forecasting itself, torch, lightning, numpy, scipy, pandas, cpflows, matplotlib, optuna, optuna-integration, pytorch_optimizer, scikit-learn, scikit-base, and statsmodels. The list includes both core dependencies and optional dependencies that may affect available features.
show_versions: The main entry point that calls both _get_sys_info and _get_deps_info with the default dependency list, then formats and prints the results in a human-readable two-column layout with right-aligned labels.
Usage
Use show_versions at the start of bug reports to provide a complete snapshot of the environment. Call it interactively in a notebook or terminal when debugging import errors, version conflicts, or unexpected behavior. It is also useful in CI/CD pipelines to log the exact environment configuration for build reproducibility.
Theoretical Basis
Dependency Version Resolution:
# Pseudo-code: version resolution strategy
def get_dependency_versions(packages, source="distributions"):
if source == "distributions":
# Use package metadata (pip-installed versions)
installed = get_all_installed_packages()
return {pkg: installed.get(pkg, None) for pkg in packages}
else:
# Use runtime import and __version__ attribute
versions = {}
for pkg in packages:
try:
module = import_module(pkg)
versions[pkg] = module.__version__
except ImportError:
versions[pkg] = None
return versions
Default Dependency Categories:
The default dependency list covers several functional categories:
- Core runtime: torch, lightning, numpy, scipy, pandas
- Package management: pip, scikit-base
- Machine learning: scikit-learn, statsmodels
- Visualization: matplotlib
- Hyperparameter optimization: optuna, optuna-integration
- Specialized: cpflows (for normalizing flows), pytorch_optimizer (for advanced optimizers)
Output Format:
# Pseudo-code: formatted output
def show_versions():
print("System:")
print(f" python: {sys.version}")
print(f"executable: {sys.executable}")
print(f" machine: {platform.platform()}")
print("Python dependencies:")
for package, version in dependency_versions.items():
print(f" {package}: {version}")
The output is designed to be directly pasteable into issue trackers and documentation, providing all information needed to reproduce an environment.