Comfy-Org / Comfy-Org/ComfyUI

Enhanced run_comfyui.bat with Automated Dependency Checking and CUDA PyTorch Detection

Open
#10,705 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

# Feature Request: Enhanced run_comfyui.bat with Automated Dependency Checking and CUDA PyTorch Detection

## Problem

Windows users often encounter frustrating issues when setting up ComfyUI:

1. **Missing Dependencies**: Users encounter cryptic `ModuleNotFoundError` messages when dependencies are missing, requiring manual troubleshooting and installation
2. **CPU-Only PyTorch**: Many users accidentally install CPU-only PyTorch, which prevents GPU acceleration and causes significant performance issues without clear indication of the problem
3. **Poor Error Messages**: Existing error messages don't provide clear guidance on how to resolve issues, leaving users to search forums and documentation
4. **Installation Confusion**: Users are unsure which dependencies are required vs optional, and whether they should install in virtual environments

These issues create a poor first-time user experience and increase support burden.

## Proposed Solution

Enhance the `run_comfyui.bat` startup script to:

- **Automated Dependency Checking**: Check all critical Python dependencies before launching ComfyUI, with clear prompts for missing packages
- **CUDA PyTorch Detection**: Automatically detect CPU-only PyTorch installations and offer to install the CUDA-enabled version
- **User-Friendly Error Messages**: Provide clear, actionable error messages with specific troubleshooting steps
- **Virtual Environment Guidance**: Detect virtual environments and provide appropriate warnings and guidance
- **Progress Feedback**: Show progress bars during installations for better user experience

## Benefits

- **Reduced Support Burden**: Common setup issues are caught and resolved automatically
- **Better User Experience**: Windows users get clear guidance instead of cryptic errors
- **GPU Support**: Automatically ensures users have CUDA-enabled PyTorch for optimal performance
- **Professional Appearance**: Polished interface with clear formatting and helpful prompts

## Implementation Details

The enhancement would:
- Check for missing dependencies using `importlib.util.find_spec()`
- Separate critical vs optional dependencies
- Detect CPU-only PyTorch by checking version string for "+cpu" indicator
- Provide interactive prompts for installation options
- Maintain full backward compatibility with existing functionality

## Additional Notes

- All installations would be optional (users can cancel at any time)
- The script would warn users about system Python vs virtual environment implications
- All existing functionality would be preserved
- The enhancement is designed to be safe and non-destructive

## Status

I have a complete PR ready to submit if this feature is desired. The implementation includes comprehensive dependency checking, CUDA PyTorch auto-installation, user-friendly error handling, and has been tested in various scenarios.

---

**Note**: This addresses common user pain points that may not have been formally reported as issues, but are frequently encountered in the community (especially on Discord/Matrix support channels).

Contributor guide

Open the contributing guide

Research direction

Start by reading run_comfyui.bat and running it on Windows with missing dependencies and CPU-only PyTorch. Compare the behavior with the requested importlib.util.find_spec() checks and the +cpu version detection. Done means optional checks, prompts, guidance, and progress feedback work while existing startup behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.