[GH-ISSUE #536] No module named 'distutils' error can be fixed with pip install distutils #251

Closed
opened 2026-10-27 21:15:20 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @Wraithnaut on GitHub (Apr 2, 2024).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/536

Manager wouldn't import for me yesterday with the message No module named 'distutils'. Not sure how this happened but updating pip might have broke something in my venv, though a fresh venv also had the same problem.

pip install distutils was enough to fix the issue however.

I've included some log information here for future reference below in case someone else experiences this and comes searching for it.

Current version information after the fix:

$ python -V
Python 3.12.2

$ pip list
pip                      24.0

** ComfyUI startup time: 2024-04-02 10:10:07.605240
** Platform: Linux
** Python version: 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)]
** Python executable: /mnt/sdb3/ComfyUI-2024-04/bin/python
** Log path: /mnt/sdb3/ComfyUI-2024-04/comfyui.log

### Loading: ComfyUI-Manager (V2.13)
### ComfyUI Revision: 2095 [e6482fbb] | Released on '2024-04-01'

Prior error log excerpts from before the fix, presumably with ComfyUI-Manager (V2.11) or earlier:

...

Failed to execute startup-script: /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager/prestartup_script.py / No module named 'distutils'

Prestartup times for custom nodes:
   0.0 seconds (PRESTARTUP FAILED): /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager

...

Traceback (most recent call last):
  File "/mnt/sdb3/ComfyUI-2024-04/nodes.py", line 1889, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager/__init__.py", line 20, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

Cannot import /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager module for custom nodes: No module named 'distutils'

...

Import times for custom nodes:
   0.0 seconds (IMPORT FAILED): /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager
...
Originally created by @Wraithnaut on GitHub (Apr 2, 2024). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/536 Manager wouldn't import for me yesterday with the message ```No module named 'distutils'```. Not sure how this happened but updating pip might have broke something in my venv, though a fresh venv also had the same problem. ```pip install distutils``` was enough to fix the issue however. I've included some log information here for future reference below in case someone else experiences this and comes searching for it. Current version information after the fix: ``` $ python -V Python 3.12.2 $ pip list pip 24.0 ** ComfyUI startup time: 2024-04-02 10:10:07.605240 ** Platform: Linux ** Python version: 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] ** Python executable: /mnt/sdb3/ComfyUI-2024-04/bin/python ** Log path: /mnt/sdb3/ComfyUI-2024-04/comfyui.log ### Loading: ComfyUI-Manager (V2.13) ### ComfyUI Revision: 2095 [e6482fbb] | Released on '2024-04-01' ``` Prior error log excerpts from before the fix, presumably with ComfyUI-Manager (V2.11) or earlier: ``` ... Failed to execute startup-script: /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager/prestartup_script.py / No module named 'distutils' Prestartup times for custom nodes: 0.0 seconds (PRESTARTUP FAILED): /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager ... Traceback (most recent call last): File "/mnt/sdb3/ComfyUI-2024-04/nodes.py", line 1889, in load_custom_node module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager/__init__.py", line 20, in <module> from distutils.version import StrictVersion ModuleNotFoundError: No module named 'distutils' Cannot import /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager module for custom nodes: No module named 'distutils' ... Import times for custom nodes: 0.0 seconds (IMPORT FAILED): /mnt/sdb3/ComfyUI-2024-04/custom_nodes/ComfyUI-Manager ... ```
Author
Owner

@ltdrdata commented on GitHub (Apr 2, 2024):

distutils should be included by default since it's part of the standard library. It seems to be an issue that arises in some special environments.

anyway this is fixed.

<!-- gh-comment-id:2032397399 --> @ltdrdata commented on GitHub (Apr 2, 2024): `distutils` should be included by default since it's part of the standard library. It seems to be an issue that arises in some special environments. anyway this is fixed.
Author
Owner

@ltdrdata commented on GitHub (Apr 3, 2024):

FYI, it has been identified that pip installation of distutils does not work in some environments, so the structure has been changed.

<!-- gh-comment-id:2033657038 --> @ltdrdata commented on GitHub (Apr 3, 2024): FYI, it has been identified that pip installation of `distutils` does not work in some environments, so the structure has been changed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#251
No description provided.