comfy-env 0.1.18__py3-none-any.whl → 0.1.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- comfy_env/isolation/workers/mp.py +17 -6
- comfy_env/isolation/workers/subprocess.py +15 -0
- comfy_env/isolation/wrap.py +7 -3
- {comfy_env-0.1.18.dist-info → comfy_env-0.1.20.dist-info}/METADATA +1 -1
- {comfy_env-0.1.18.dist-info → comfy_env-0.1.20.dist-info}/RECORD +8 -8
- {comfy_env-0.1.18.dist-info → comfy_env-0.1.20.dist-info}/WHEEL +0 -0
- {comfy_env-0.1.18.dist-info → comfy_env-0.1.20.dist-info}/entry_points.txt +0 -0
- {comfy_env-0.1.18.dist-info → comfy_env-0.1.20.dist-info}/licenses/LICENSE +0 -0
|
@@ -565,7 +565,9 @@ class MPWorker(Worker):
|
|
|
565
565
|
interpreter without inherited state from the parent.
|
|
566
566
|
"""
|
|
567
567
|
|
|
568
|
-
def __init__(self, name: Optional[str] = None, sys_path: Optional[list] = None,
|
|
568
|
+
def __init__(self, name: Optional[str] = None, sys_path: Optional[list] = None,
|
|
569
|
+
lib_path: Optional[str] = None, env_vars: Optional[dict] = None,
|
|
570
|
+
python: Optional[str] = None):
|
|
569
571
|
"""
|
|
570
572
|
Initialize the worker.
|
|
571
573
|
|
|
@@ -574,11 +576,15 @@ class MPWorker(Worker):
|
|
|
574
576
|
sys_path: Optional list of paths to add to sys.path in worker process.
|
|
575
577
|
lib_path: Optional path to add to LD_LIBRARY_PATH (for conda libraries).
|
|
576
578
|
env_vars: Optional environment variables to set in worker process.
|
|
579
|
+
python: Optional path to venv Python executable for true process isolation.
|
|
580
|
+
When provided, spawn uses this Python instead of sys.executable,
|
|
581
|
+
avoiding Windows issues where spawn re-imports main.py.
|
|
577
582
|
"""
|
|
578
583
|
self.name = name or "MPWorker"
|
|
579
584
|
self._sys_path = sys_path or []
|
|
580
585
|
self._lib_path = lib_path
|
|
581
586
|
self._env_vars = env_vars or {}
|
|
587
|
+
self._python = python # Venv Python for true isolation (like pyisolate)
|
|
582
588
|
self._process = None
|
|
583
589
|
self._queue_in = None
|
|
584
590
|
self._queue_out = None
|
|
@@ -635,13 +641,18 @@ class MPWorker(Worker):
|
|
|
635
641
|
# Use spawn to get clean subprocess (no inherited CUDA context)
|
|
636
642
|
ctx = mp.get_context('spawn')
|
|
637
643
|
|
|
638
|
-
#
|
|
639
|
-
#
|
|
644
|
+
# Set the spawn executable for true process isolation (like pyisolate)
|
|
645
|
+
# When venv python is provided, use it to avoid Windows spawn importing main.py
|
|
640
646
|
import multiprocessing.spawn as mp_spawn
|
|
641
647
|
original_exe = mp_spawn.get_executable()
|
|
642
|
-
if
|
|
643
|
-
|
|
644
|
-
|
|
648
|
+
if self._python:
|
|
649
|
+
# True isolation: use venv Python (fixes Windows spawn __main__ issue)
|
|
650
|
+
mp_spawn.set_executable(self._python)
|
|
651
|
+
else:
|
|
652
|
+
# Fallback: use current Python (may fail on Windows with ComfyUI)
|
|
653
|
+
if original_exe != sys.executable.encode() and original_exe != sys.executable:
|
|
654
|
+
print(f"[comfy-env] Warning: spawn executable was {original_exe}, forcing to {sys.executable}")
|
|
655
|
+
mp_spawn.set_executable(sys.executable)
|
|
645
656
|
|
|
646
657
|
self._queue_in = ctx.Queue()
|
|
647
658
|
self._queue_out = ctx.Queue()
|
|
@@ -533,6 +533,21 @@ if sys.platform == "win32":
|
|
|
533
533
|
from multiprocessing import shared_memory as shm
|
|
534
534
|
import numpy as np
|
|
535
535
|
|
|
536
|
+
|
|
537
|
+
def _prepare_trimesh_for_pickle(mesh):
|
|
538
|
+
"""
|
|
539
|
+
Prepare a trimesh object for cross-Python-version pickling.
|
|
540
|
+
Strips native extension helpers that cause import errors.
|
|
541
|
+
"""
|
|
542
|
+
mesh = mesh.copy()
|
|
543
|
+
for attr in ('ray', '_ray', 'permutate', 'nearest'):
|
|
544
|
+
try:
|
|
545
|
+
delattr(mesh, attr)
|
|
546
|
+
except AttributeError:
|
|
547
|
+
pass
|
|
548
|
+
return mesh
|
|
549
|
+
|
|
550
|
+
|
|
536
551
|
def _to_shm(obj, registry, visited=None):
|
|
537
552
|
"""Serialize to shared memory. Returns JSON-safe metadata."""
|
|
538
553
|
if visited is None:
|
comfy_env/isolation/wrap.py
CHANGED
|
@@ -74,16 +74,20 @@ def _get_worker(env_dir: Path, working_dir: Path, sys_path: list[str],
|
|
|
74
74
|
|
|
75
75
|
host_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
76
76
|
iso_ver = _get_python_version(env_dir)
|
|
77
|
+
python = env_dir / ("python.exe" if sys.platform == "win32" else "bin/python")
|
|
77
78
|
|
|
78
79
|
if iso_ver and iso_ver != host_ver:
|
|
80
|
+
# Different Python version - must use SubprocessWorker
|
|
79
81
|
from .workers.subprocess import SubprocessWorker
|
|
80
|
-
python = env_dir / ("python.exe" if sys.platform == "win32" else "bin/python")
|
|
81
82
|
print(f"[comfy-env] SubprocessWorker: {python} ({iso_ver} vs {host_ver})")
|
|
82
83
|
worker = SubprocessWorker(python=str(python), working_dir=working_dir, sys_path=sys_path, name=working_dir.name)
|
|
83
84
|
else:
|
|
85
|
+
# Same version - use MPWorker with venv Python for true isolation (like pyisolate)
|
|
86
|
+
# This fixes Windows where spawn would otherwise re-import main.py
|
|
84
87
|
from .workers.mp import MPWorker
|
|
85
|
-
print(f"[comfy-env] MPWorker: {
|
|
86
|
-
worker = MPWorker(name=working_dir.name, sys_path=sys_path, lib_path=lib_path,
|
|
88
|
+
print(f"[comfy-env] MPWorker: {python}")
|
|
89
|
+
worker = MPWorker(name=working_dir.name, sys_path=sys_path, lib_path=lib_path,
|
|
90
|
+
env_vars=env_vars, python=str(python))
|
|
87
91
|
|
|
88
92
|
_workers[cache_key] = worker
|
|
89
93
|
return worker
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: comfy-env
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: Environment management for ComfyUI custom nodes - CUDA wheel resolution and process isolation
|
|
5
5
|
Project-URL: Homepage, https://github.com/PozzettiAndrea/comfy-env
|
|
6
6
|
Project-URL: Repository, https://github.com/PozzettiAndrea/comfy-env
|
|
@@ -16,11 +16,11 @@ comfy_env/environment/paths.py,sha256=5TFFAkOZXa8R3cHfVHDEFnwy6_JcHilVBOHJuy-yqR
|
|
|
16
16
|
comfy_env/environment/setup.py,sha256=KQgeqlEaqB_tOVhsR2RQF76-LuPud2EPtkQWUM3AJ5Y,3231
|
|
17
17
|
comfy_env/isolation/__init__.py,sha256=XfMLEiBIcEzHG_k2vk9fT9GvFfmOsfbpM26czuxbdRI,800
|
|
18
18
|
comfy_env/isolation/tensor_utils.py,sha256=2_f4jjylqCPaPldD1Jw-es5CyOtuF5I1ROdyEIxsg-U,2951
|
|
19
|
-
comfy_env/isolation/wrap.py,sha256=
|
|
19
|
+
comfy_env/isolation/wrap.py,sha256=UO5tVK-Bzp-8AVxkRd9WNU8m9lOfy_oZFkA6trHOcbM,8876
|
|
20
20
|
comfy_env/isolation/workers/__init__.py,sha256=Zp6sZSRBcb5Negqgzqs3jPjfO9T1u3nNrQhp6WqTAuc,325
|
|
21
21
|
comfy_env/isolation/workers/base.py,sha256=4ZYTaQ4J0kBHCoO_OfZnsowm4rJCoqinZUaOtgkOPbw,2307
|
|
22
|
-
comfy_env/isolation/workers/mp.py,sha256=
|
|
23
|
-
comfy_env/isolation/workers/subprocess.py,sha256=
|
|
22
|
+
comfy_env/isolation/workers/mp.py,sha256=0zGDo5RxbuiSGTbTxf5qYE0tD-Sistzl48CsIOkYCdg,34777
|
|
23
|
+
comfy_env/isolation/workers/subprocess.py,sha256=15G4rQA7bO-mmVkkeeR3we9ytHIw6kHLNdjc9XWXCu8,57650
|
|
24
24
|
comfy_env/packages/__init__.py,sha256=4pRCUnfcVFVgy7hkbPz9BPVXELtSFHha6L7n-hqNuZA,1155
|
|
25
25
|
comfy_env/packages/apt.py,sha256=pxy3A5ZHv3X8ExCVyohODY8Fcy9ji4izIVPfYoxhqT4,1027
|
|
26
26
|
comfy_env/packages/cuda_wheels.py,sha256=G_CnlwNcfeWlEU24aCVBpeqQQ05y8_02dDLBwBFNwII,3980
|
|
@@ -29,8 +29,8 @@ comfy_env/packages/pixi.py,sha256=RPu8x5sSOLE1CYAhWMMjoQrbFGGt00fdsbqtRcTz7LQ,38
|
|
|
29
29
|
comfy_env/packages/toml_generator.py,sha256=Vhc8F9euHhMTwH1TV6t96-D9Pjrn9jIN4e9WXrCIFE8,3414
|
|
30
30
|
comfy_env/templates/comfy-env-instructions.txt,sha256=ve1RAthW7ouumU9h6DM7mIRX1MS8_Tyonq2U4tcrFu8,1031
|
|
31
31
|
comfy_env/templates/comfy-env.toml,sha256=ROIqi4BlPL1MEdL1VgebfTHpdwPNYGHwWeigI9Kw-1I,4831
|
|
32
|
-
comfy_env-0.1.
|
|
33
|
-
comfy_env-0.1.
|
|
34
|
-
comfy_env-0.1.
|
|
35
|
-
comfy_env-0.1.
|
|
36
|
-
comfy_env-0.1.
|
|
32
|
+
comfy_env-0.1.20.dist-info/METADATA,sha256=TnybPs-8qbU-3NjJxnAadtdp2mj7Pj6fjTfMA2e7PqQ,4808
|
|
33
|
+
comfy_env-0.1.20.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
34
|
+
comfy_env-0.1.20.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
|
|
35
|
+
comfy_env-0.1.20.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
|
|
36
|
+
comfy_env-0.1.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|