ModuleNotFoundError: No module named 'torchsde' in ComfyUI
Fix ComfyUI No module named torchsde errors by installing torchsde after verifying the active Torch and CUDA environment.
If ComfyUI logs ModuleNotFoundError: No module named 'torchsde', install the Python package torchsde in the same environment that launches ComfyUI.
Because torchsde sits near the PyTorch stack, check Torch first. If your Torch import is CPU-only or CUDA is broken, repair Torch/CUDA before adding more packages.
In the SEO Lab portable repair chain, missing torchsde appeared after transformers was installed. Installing torchsde exposed the next dependency, av.
Fast answer
For the GitHub Windows portable package:
.\python_embeded\python.exe -s -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"
.\python_embeded\python.exe -s -m pip show torchsde
.\python_embeded\python.exe -s -m pip install torchsde
.\python_embeded\python.exe -s -c "import torchsde; print('import ok')"
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-buildWhat The Log Looks Like
ModuleNotFoundError: No module named 'torchsde'This often appears after the core model stack starts loading successfully enough to reach sampler or model utility imports.
Quick Diagnosis
| What You See | Meaning | First Action |
|---|---|---|
No module named 'torchsde' | torchsde package missing | Install torchsde in ComfyUI's Python |
| Torch import fails first | Lower-level problem | Fix Torch before torchsde |
torch.cuda.is_available() is false unexpectedly | CUDA Torch problem | Use the CUDA Torch guide first |
Error changes to No module named 'av' | Repair chain moved forward | Continue with the AV guide |
Step 1: Verify Torch First
Windows portable:
.\python_embeded\python.exe -s -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"Manual venv:
python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"If CUDA should be available but the output is CPU-only or false, do not start with torchsde. Fix Torch/CUDA first.
Step 2: Install torchsde
Windows portable:
.\python_embeded\python.exe -s -m pip install torchsdeManual venv:
python -m pip install torchsdeThen verify:
.\python_embeded\python.exe -s -c "import torchsde; print('import ok')"Step 3: Restart ComfyUI
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-buildIf the next missing package is av, that means the startup chain moved past torchsde.
What Not To Do
- do not install
torchsdebefore checking that Torch imports - do not let
pip install torchsdereplace your working CUDA Torch stack - do not use system Python when ComfyUI uses
python_embeded - do not treat this as a model-file problem
Related Guides
- ModuleNotFoundError: No module named 'torch' in ComfyUI
- Torch Not Compiled With CUDA Enabled
- No module named 'av' in ComfyUI
- Repair ComfyUI Portable Dependencies One Missing Module At A Time
- Fix No module named errors in ComfyUI
Source References
- Windows portable SEO Lab repair, May 18, 2026:
ModuleNotFoundError: No module named 'torchsde'appeared after Transformers repair - Same lab
ComfyUI\requirements.txt:torchsde - torchsde on PyPI
Start free with Wonderful Launcher if this affects your real ComfyUI environment. It keeps launcher-native repair, task logs, and runtime checks in one place; credits are only for image generation and metered tools.
Download Wonderful LauncherSee credit packagesDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.