Diagnose & fix ML environments for LLM fine-tuning
Project description
ML Environment Doctor
Single command fixes many "why is my ML environment broken?" problems.
ML Environment Doctor is a Python CLI for diagnosing and repairing ML environments. It checks CUDA, PyTorch, TensorFlow/Keras, and JAX/Flax readiness, generates shareable reports, emits CI-friendly exit codes, and creates Dockerfile templates for training workflows.
- Repository:
https://github.com/Dheena731/Ml-env-doctor - PyPI:
https://pypi.org/project/mlenvdoctor/
Why ML Environment Doctor?
Problem: ML environment setup is fragmented across forum answers, conflicting CUDA wheels, and half-working virtual environments.
Solution: one CLI that:
- Diagnoses CUDA, Python, and ML framework issues quickly
- Suggests copy-paste fixes for common failures
- Emits machine-readable JSON and stable exit codes for CI
- Saves HTML and JSON reports for teammates
- Generates recommended dependency stacks for LLM training
Quick Start
# Install
pip install mlenvdoctor
# Human-readable diagnosis
mlenvdoctor diagnose
# Full scan
mlenvdoctor diagnose --full
# JSON to stdout for CI/parsers
mlenvdoctor diagnose --json -
# CI-friendly compact summary
mlenvdoctor doctor --ci
# Save a shareable report bundle
mlenvdoctor report
# Generate a recommended LLM training requirements file
mlenvdoctor stack llm-training -o requirements-llm-training.txt
30-Second Quickstart
pip install mlenvdoctor
mlenvdoctor diagnose
mlenvdoctor diagnose --json -
mlenvdoctor report
If you are debugging a teammate's machine or a CI runner, start with mlenvdoctor report and share the generated JSON/HTML pair.
Features
Diagnosis
- CUDA driver and GPU visibility checks
- PyTorch CUDA availability and version checks
- TensorFlow runtime and Keras 3 readiness checks
- JAX backend and Flax installation checks
- GPU memory warnings
- Disk space checks for model cache usage
- Docker GPU support detection
- Hugging Face connectivity checks
Machine-Readable Output
mlenvdoctor diagnose --json -prints JSON to stdout- Exit codes are stable for automation:
0: healthy1: warnings present2: critical issues present
Reports
mlenvdoctor reportsaves timestamped JSON and HTML reports- Output can be attached to CI jobs or shared with teammates
Fixes
- Failures include copy-paste fix commands where possible
mlenvdoctor fixcan generaterequirements.txtor Conda environment filesmlenvdoctor fix --venvcan create and use a virtual environment
Stacks
mlenvdoctor stack llm-trainingprints a recommended dependency stack for fine-tuningmlenvdoctor fix --stack llm-traininguses that stack for generated requirements
MCP
mlenvdoctor mcp serveexposes a minimal JSON-line MCP stub- Current stub tools:
diagnoseget_fixes
Examples
Diagnose
mlenvdoctor diagnose
mlenvdoctor diagnose --full
mlenvdoctor diagnose --json -
CI
mlenvdoctor doctor --ci
mlenvdoctor doctor --ci --full
Reports
mlenvdoctor report
mlenvdoctor report --quick --output-dir artifacts/mlenvdoctor
Stacks
mlenvdoctor stack llm-training
mlenvdoctor stack llm-training -o requirements-llm-training.txt
Auto-Fix
mlenvdoctor fix
mlenvdoctor fix --conda
mlenvdoctor fix --venv
mlenvdoctor fix --stack llm-training
Dockerize
mlenvdoctor dockerize mistral-7b
mlenvdoctor dockerize --service
Troubleshooting Examples
# Your CI job wants JSON
mlenvdoctor diagnose --json -
# Your team wants a report bundle
mlenvdoctor report --output-dir artifacts/mlenvdoctor
# Your pipeline wants a one-line summary plus fix hints
mlenvdoctor doctor --ci
# You want a starting dependency set for fine-tuning
mlenvdoctor stack llm-training -o requirements-llm-training.txt
Installation
# From PyPI
pip install mlenvdoctor
# From source
git clone https://github.com/Dheena731/Ml-env-doctor.git
cd Ml-env-doctor
pip install -e .
Development
git clone https://github.com/Dheena731/Ml-env-doctor.git
cd Ml-env-doctor
pip install -e ".[dev]"
pytest
ruff check src/ tests/
black src/ tests/
mypy src/
Repository
- GitHub: Dheena731/Ml-env-doctor
- Issues: Open an issue
- Clone URL:
https://github.com/Dheena731/Ml-env-doctor.git
Contributing
Contributions are welcome. See CONTRIBUTING.md.
License
This project is licensed under the MIT License. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlenvdoctor-0.1.3.tar.gz.
File metadata
- Download URL: mlenvdoctor-0.1.3.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7486388a6e31d28e0a41d006f40fe204135ce229c568fc769b062241c2ef4484
|
|
| MD5 |
0ab3115bff7976d8a328c53221e32d08
|
|
| BLAKE2b-256 |
fc7037d0bc424c0898288cb0553fb1525159816d0812dbf038236fec87cb329a
|
File details
Details for the file mlenvdoctor-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mlenvdoctor-0.1.3-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10101713f32fb7bf34cadc5d7a8d80d600f7fa3840dbe47c7ed5fcdced5ea4dd
|
|
| MD5 |
8d068b79cddadc451528cfa5a86101f6
|
|
| BLAKE2b-256 |
d5307f214a05610dc6ae433f4e0195fef1ae16c5c33d225ac041b050f12a4dd2
|