Skip to content

[Bug] Step Audio EditX pollutes PYTHONPATH and intermittently crashes Qwen3-TTS worker ('utils' is not a package) #366

Description

@haroonaslam

Describe the bug
After a successful Qwen3-TTS run followed by Step Audio EditX inline post-processing, a later recreation of the isolated Qwen3-TTS worker can fail before initialization with:

ModuleNotFoundError: No module named 'utils.audio'; 'utils' is not a package

Restarting ComfyUI temporarily fixes it. The failure returns after Step Audio EditX has been loaded and the Qwen worker is subsequently recreated.

This appears to be deterministic sys.path / PYTHONPATH poisoning rather than a CUDA or model problem.

Root cause / confirmed reproduction

  1. engines/step_audio_editx/step_audio_editx_impl/model_loader.py and tokenizer.py insert step_audio_editx_impl at index 0 of the parent process's global sys.path.
  2. That directory contains a standalone utils.py.
  3. utils/runtimes/launcher.py::build_env() copies the current parent sys.path, in its existing order, into the child worker's PYTHONPATH.
  4. utils/runtimes/workers/qwen3_tts_worker.py only inserts PROJECT_ROOT when it is absent. If the suite root is already present later in inherited PYTHONPATH, it is not moved to the front.
  5. The child therefore resolves utils to step_audio_editx_impl/utils.py instead of the suite's utils/ package. The worker dies while importing utils.runtimes.protocol.

The exact failure can be reproduced without loading either model:

$suite = '<ComfyUI>\custom_nodes\tts_audio_suite'
$impl = "$suite\engines\step_audio_editx\step_audio_editx_impl"
$env:PYTHONPATH = "$impl;$suite"
& "$suite\runtimes\shared_legacy_t4\Scripts\python.exe" `
  "$suite\utils\runtimes\workers\qwen3_tts_worker.py"

This produces:

Traceback (most recent call last):
  File "...\utils\runtimes\workers\qwen3_tts_worker.py", line 18, in <module>
    from utils.runtimes.protocol import RuntimeJobResponse
  File "...\engines\step_audio_editx\step_audio_editx_impl\utils.py", line 13, in <module>
    from utils.audio.librosa_fallback import safe_trim
ModuleNotFoundError: No module named 'utils.audio'; 'utils' is not a package

Suggested fix
Make worker import precedence deterministic. Possible fixes:

  • In IsolatedRuntimeLauncher.build_env(), prepend runtime_root before inherited sys.path entries, then deduplicate; and/or
  • In every worker entrypoint, remove all existing normalized occurrences of PROJECT_ROOT and unconditionally insert it at index 0 before importing utils.*.
  • Longer term, avoid permanently adding step_audio_editx_impl to the parent process's global sys.path; use package-relative imports or a scoped import strategy.

Simply using a dedicated runtime profile does not prevent this because the poisoned PYTHONPATH is inherited by every profile.

Init log / relevant environment

OS: Microsoft Windows 11 Pro 10.0.26200
ComfyUI type: Easy Install / embedded Python
GPU: NVIDIA GeForce RTX 5090, 32607 MiB
NVIDIA driver: 591.86
RAM: 127.4 GB
Python: 3.12.10 [MSC v.1943 64 bit]
ComfyUI: 0.34.0
TTS Audio Suite: 5.8.5
PyTorch: 2.13.0+cu130
TorchAudio: 2.11.0+cu130
Transformers (main runtime): 5.12.1
NumPy: 1.26.4
Librosa: 0.11.0
Numba: 0.65.0
SoundFile: 0.13.1
CUDA available: True
Torch CUDA: 13.0
Isolated profile involved: vibevoice_transformers4_shared

Provide your ERROR full log

Traceback (most recent call last):
  File "D:\ComfyUI\ComfyUI-Easy-Install\ComfyUI\custom_nodes\tts_audio_suite\utils\runtimes\workers\qwen3_tts_worker.py", line 18, in <module>
    from utils.runtimes.protocol import RuntimeJobResponse
  File "D:\ComfyUI\ComfyUI-Easy-Install\ComfyUI\custom_nodes\tts_audio_suite\engines\step_audio_editx\step_audio_editx_impl\utils.py", line 13, in <module>
    from utils.audio.librosa_fallback import safe_trim
ModuleNotFoundError: No module named 'utils.audio'; 'utils' is not a package
❌ Failed to create engine node instance: Worker closed the response stream unexpectedly
❌ TTS Text generation failed: Failed to create engine node instance
Traceback (most recent call last):
  File "D:\ComfyUI\ComfyUI-Easy-Install\ComfyUI\custom_nodes\tts_audio_suite\nodes\unified\tts_text_node.py", line 1074, in generate_speech
    raise RuntimeError("Failed to create engine node instance")
RuntimeError: Failed to create engine node instance

Steps to reproduce through ComfyUI

  1. Restart ComfyUI.
  2. Run Qwen3-TTS with Step Audio EditX inline tags such as <emotion:happy>.
  3. Allow runtime isolation to load Step Audio EditX after Qwen generation.
  4. Run again after Qwen's isolated worker has been shut down and needs recreation.
  5. Qwen worker intermittently/deterministically exits at its first utils.runtimes.protocol import, depending on the inherited path state.

Additional context
The downloaded Step-Audio-EditX, tokenizer, CosyVoice, and FunASR model files are complete and pass the suite's model checks. Restarting ComfyUI clears the mutated import state, explaining why the workaround succeeds temporarily.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions