Overview
Theverify_environment.py script validates that all required dependencies, packages, and datasets are properly installed and accessible before running experiments.
Location: scripts/verify_environment.py
Usage
Verification Checks
System Information
- Python Version: Reports the active Python interpreter version
- Platform: Displays the operating system and platform details
Required Packages
Verifies installation and version of critical dependencies:numpy- Numerical computingmatplotlib- Plotting and visualizationpsutil- System and process utilitiesrequests- HTTP librarytqdm- Progress bars
Optional Packages
Checks for optional dependencies:torch- PyTorch deep learning frameworkpytest- Testing framework
Dataset Status
Validates Fashion-MNIST dataset availability:- Training set: Checks file existence and size
- Test set: Checks file existence and size
- Uses dataset configuration from
dataset_config.py
Example Output
Exit Behavior
The script does not exit with error codes. It reports all findings to stdout for manual review. This allows users to:- Identify missing packages
- Verify version compatibility
- Check dataset integrity
- Diagnose environment issues before running experiments
Implementation Details
Module Checking
Uses dynamic import to test package availability:__version__ attribute when available.
Dataset Verification
- Imports
FASHION_MNIST_SPECfromdataset_config.py - Checks file existence using
Path.exists() - Reports file size in bytes for integrity validation
Path Resolution
- Automatically resolves repository root from script location
- Adds task directory to
sys.pathfor local imports - Uses
pathlib.Pathfor cross-platform compatibility
Troubleshooting
Missing Package
If a required package showsMISSING, install it:
Dataset Unavailable
If dataset status showstrain_exists=False or test_exists=False:
- Run the dataset download script
- Verify
dataset_config.pypaths are correct - Check file permissions
Import Errors
Ifdataset_config import fails:
- Ensure you’re running from the repository root
- Verify the task directory structure exists
- Check for syntax errors in
dataset_config.py
Use Cases
Pre-Experiment Validation
CI/CD Pipeline
Debugging Environment Issues
Related
- run_workflow.py - Experiment workflow orchestration
- Dataset Configuration - Dataset path configuration