Overview
show_versions, _get_deps_info, and _get_sys_info are utility functions that collect and display system information and dependency versions for debugging and issue reporting.
Description
show_versions prints a formatted summary of the Python version, executable path, OS platform, and version numbers for key dependencies (pytorch-forecasting, torch, lightning, numpy, pandas, and others). It delegates to _get_sys_info for system-level details and _get_deps_info for package version lookups. _get_deps_info supports two version resolution strategies: "distributions" (via importlib metadata / PEP 440 package names) and "import" (via module __version__ attributes). This module is adapted from scikit-learn's and sktime's utilities of the same name.
Usage
Use show_versions to quickly print environment details when debugging issues or filing bug reports. It provides a standardized summary of all relevant package versions and system configuration, making it easy to reproduce and diagnose environment-specific problems.
Code Reference
Source Location
Signature
def _get_deps_info(deps=None, source="distributions"):
Import
from pytorch_forecasting.utils._maint._show_versions import show_versions
from pytorch_forecasting.utils._maint._show_versions import _get_deps_info
from pytorch_forecasting.utils._maint._show_versions import _get_sys_info
I/O Contract
Inputs (show_versions)
| Name |
Type |
Required |
Description
|
| (none) |
-- |
-- |
Takes no parameters; uses the DEFAULT_DEPS_TO_SHOW list internally
|
Inputs (_get_sys_info)
| Name |
Type |
Required |
Description
|
| (none) |
-- |
-- |
Takes no parameters
|
Inputs (_get_deps_info)
| Name |
Type |
Required |
Description
|
| deps |
list[str] or None |
No |
List of package names to query; defaults to ["pytorch-forecasting"] if None
|
| source |
str |
No |
Version lookup strategy: "distributions" uses importlib metadata with PEP 440 names, "import" uses __version__ attribute with import names; defaults to "distributions"
|
Outputs
| Name |
Type |
Description
|
| show_versions |
None |
Prints system info and dependency versions to stdout; no return value
|
| _get_sys_info |
dict |
Dictionary with keys "python", "executable", and "machine" containing system details
|
| _get_deps_info |
dict |
Dictionary mapping package names to their version strings (or None if not installed)
|
Usage Examples
from pytorch_forecasting.utils._maint._show_versions import show_versions
# Print all system and dependency information
show_versions()
# Output:
# System:
# python: 3.10.12 (main, ...)
# executable: /usr/bin/python3
# machine: Linux-5.15.0-x86_64
#
# Python dependencies:
# pip: 23.2.1
# pytorch-forecasting: 1.1.1
# torch: 2.1.0
# lightning: 2.1.0
# numpy: 1.26.0
# ...
from pytorch_forecasting.utils._maint._show_versions import _get_deps_info, _get_sys_info
# Get system info as a dictionary
sys_info = _get_sys_info()
print(sys_info["python"]) # e.g., "3.10.12 (main, ...)"
print(sys_info["machine"]) # e.g., "Linux-5.15.0-x86_64"
# Get specific dependency versions
deps = _get_deps_info(deps=["torch", "numpy", "pandas"])
print(deps["torch"]) # e.g., "2.1.0"
print(deps["numpy"]) # e.g., "1.26.0"
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.