Troubleshooting Dependency Conflicts¶
Diagnose and resolve Python dependency conflicts when managing custom nodes.
Overview¶
Dependency conflicts are one of the most common issues when working with ComfyUI custom nodes. This guide helps you diagnose and fix conflicts using ComfyGit's built-in tools and UV's dependency resolver.
Quick diagnosis checklist¶
When you encounter a dependency conflict:
- Read the error message carefully - UV provides detailed conflict information
- Check which packages conflict - Look for version mismatches
- Identify the conflicting nodes - See which nodes require incompatible versions
- Try suggested actions - ComfyGit provides actionable fixes
- Use constraints if needed - Pin problematic packages to compatible versions
Understanding UV error messages¶
ComfyGit uses UV's dependency resolver, which provides detailed error output when conflicts occur.
Basic conflict structure¶
The error shows:
- Which packages conflict - e.g.,
torch - What versions are needed - e.g.,
==2.0.0vs>=2.1.0 - Which nodes require them - e.g.,
node-aandnode-b
Full UV resolution output¶
UV provides a complete dependency chain showing why packages are required:
× No solution found when resolving dependencies:
╰─▶ Because node-a depends on torch==2.0.0 and node-b depends on torch>=2.1.0,
we can conclude that node-a and node-b are incompatible.
And because you require node-a and node-b, we can conclude that
your requirements are unsatisfiable.
This shows the logical chain that leads to the conflict.
Common conflict scenarios¶
PyTorch version conflicts¶
Most frequent issue - Different nodes require different PyTorch versions.
Example error:
$ cg node add new-cuda-node
✗ Dependency conflict detected
• existing-node requires torch==2.0.1+cu117
• new-cuda-node requires torch==2.1.0+cu121
Diagnosis steps:
-
Check your current PyTorch version:
-
Check which nodes require specific versions:
Solutions:
Package pinning conflicts¶
Example error:
$ cg node add old-library-node
✗ Dependency conflict detected
• old-library-node requires pillow==8.0.0
• modern-node requires pillow>=10.0.0
Options:
1. Update conflicting node
→ cg node update old-library-node
2. Remove conflicting node
→ cg node remove modern-node
Diagnosis:
Check if either node has updates that relax the constraint:
Solutions:
For development nodes, you can manually relax constraints:
Sub-dependency (transitive) conflicts¶
Example error:
$ cg node add complex-node
✗ Failed to resolve dependencies
• requests (required by node-a) requires urllib3>=1.26
• boto3 (required by node-b) requires urllib3<1.27
Neither node directly requires urllib3, but their dependencies do.
Diagnosis:
Use verbose mode to see the full dependency tree:
Solutions:
Using diagnostic commands¶
Verbose mode for detailed errors¶
Add --verbose to see full UV error output:
This shows:
- Complete dependency resolution trace
- All package versions considered
- Exact reason for each rejection
Check environment consistency¶
After resolving conflicts, verify environment health:
# Show environment status
cg status
# Look for warnings like:
# ⚠ Environment out of sync (2 changes)
If out of sync, repair:
View dependency tree¶
See which nodes require which packages:
# List all nodes with their dependencies
cg node list --verbose
# Check specific package usage
cg py list | grep <package-name>
Using constraints to fix conflicts¶
Constraints are UV-specific version pins that apply globally to your environment.
When to use constraints¶
- Before adding nodes - Establish compatibility baseline
- After conflicts - Force compatible versions
- For stability - Lock critical packages (PyTorch, CUDA)
Adding constraints¶
# Pin PyTorch to specific version
cg constraint add "torch==2.1.0+cu121"
# Prevent major version updates
cg constraint add "pillow>=9.0.0,<10.0.0"
# Ensure minimum version
cg constraint add "numpy>=1.24.0"
Viewing active constraints¶
Example output:
Constraint dependencies in 'production':
• torch==2.1.0+cu121
• pillow>=9.0.0,<10.0.0
• numpy>=1.24.0
Removing constraints¶
See Python Dependencies: Constraints for more details.
Step-by-step resolution workflow¶
1. Attempt installation and capture error¶
Read the error carefully - it tells you exactly what conflicts.
2. Use suggested actions¶
ComfyGit provides numbered suggestions:
Options:
1. Update conflicting node
→ cg node update old-node
2. Remove conflicting node
→ cg node remove old-node
Try suggestions in order - they're ranked by likelihood of success.
3. If suggestions don't work, use constraints¶
# Add constraint for the conflicting package
cg constraint add "<package>>=<min-version>,<max-version>"
# Retry installation
cg node add new-node
4. Verify environment health¶
5. Document the solution¶
If you had to manually resolve the conflict:
Advanced troubleshooting¶
UV resolution fails with no clear conflict¶
Sometimes UV can't find any compatible versions:
Diagnosis:
Check if you have overly restrictive constraints:
Solution:
Remove or relax constraints:
Circular dependency errors¶
This is a packaging bug in one of the nodes.
Solutions:
-
Update all involved nodes:
-
Remove one node from the cycle:
-
Report to node maintainers
Environment becomes corrupted after resolution¶
After resolving conflicts, cg status shows errors:
Solution:
If repair fails:
# View detailed error output
cg repair --verbose
# Last resort: recreate environment
cg create fresh-env
cg -e fresh-env import old-env.comfygit
Preventing conflicts¶
Use constraints proactively¶
Before adding many nodes, establish a baseline:
# constraints.txt
torch==2.1.0+cu121
pillow>=9.0.0,<10.0.0
numpy>=1.24.0
# Apply constraints
cg constraint add -r constraints.txt
# Now add nodes
cg node add node-a node-b node-c
Test nodes individually¶
Add nodes one at a time to isolate conflicts:
cg node add node-a
# Test works
cg node add node-b
# Test works
cg node add node-c
# Conflict! We know node-c is the problem.
Keep nodes updated¶
Regular updates prevent accumulation of outdated dependencies:
When to use separate environments¶
Some nodes are fundamentally incompatible:
- Different major PyTorch versions (1.x vs 2.x)
- CPU-only vs GPU packages
- Conflicting system libraries (opencv-python vs opencv-python-headless)
Solution: Use multiple environments:
# Environment 1: Legacy PyTorch 1.x
cg create legacy --torch-backend cu117
cg -e legacy node add old-node
# Environment 2: Modern PyTorch 2.x
cg create modern --torch-backend cu121
cg -e modern node add new-node
Switch between environments as needed:
Getting help¶
If you're stuck after trying these steps:
-
Check the logs:
-
Run UV manually for detailed output:
-
Report to node maintainers if the issue is in their requirements
-
Ask in Discord - Share the error message and
cg statusoutput
Related documentation¶
-
Understanding node conflicts and prevention strategies
-
Managing Python packages and constraints
-
Fix sync issues with the repair command
-
Detailed guide to UV constraints