comfy-env 0.0.51__py3-none-any.whl → 0.0.52__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/pixi.py CHANGED
@@ -246,6 +246,10 @@ def create_pixi_toml(
246
246
  lines.append("[dependencies]")
247
247
  lines.append(f'python = "{env_config.python}.*"')
248
248
 
249
+ # On Windows, use MKL BLAS to avoid OpenBLAS crashes (numpy blas_fpe_check issue)
250
+ if sys.platform == "win32":
251
+ lines.append('libblas = { version = "*", build = "*mkl" }')
252
+
249
253
  for pkg in conda.packages:
250
254
  # Parse package spec (name=version or name>=version or just name)
251
255
  if "=" in pkg and not pkg.startswith("="):
comfy_env/stub_imports.py CHANGED
@@ -156,19 +156,26 @@ def _get_import_names_from_pixi(node_dir: Path) -> Set[str]:
156
156
  """
157
157
  import_names = set()
158
158
 
159
- # Find the pixi site-packages
160
- pixi_lib = node_dir / ".pixi" / "envs" / "default" / "lib"
159
+ pixi_base = node_dir / ".pixi" / "envs" / "default"
161
160
 
162
- if not pixi_lib.exists():
163
- return import_names
164
-
165
- # Find the python version directory (e.g., python3.11)
166
- python_dirs = list(pixi_lib.glob("python3.*"))
167
- if not python_dirs:
168
- return import_names
161
+ # Find site-packages (different paths on Windows vs Linux)
162
+ # Linux: .pixi/envs/default/lib/python3.x/site-packages
163
+ # Windows: .pixi/envs/default/Lib/site-packages
164
+ site_packages = None
169
165
 
170
- site_packages = python_dirs[0] / "site-packages"
171
- if not site_packages.exists():
166
+ # Try Windows path first (Lib/site-packages)
167
+ win_site = pixi_base / "Lib" / "site-packages"
168
+ if win_site.exists():
169
+ site_packages = win_site
170
+ else:
171
+ # Try Linux path (lib/python3.x/site-packages)
172
+ pixi_lib = pixi_base / "lib"
173
+ if pixi_lib.exists():
174
+ python_dirs = list(pixi_lib.glob("python3.*"))
175
+ if python_dirs:
176
+ site_packages = python_dirs[0] / "site-packages"
177
+
178
+ if site_packages is None or not site_packages.exists():
172
179
  return import_names
173
180
 
174
181
  # Scan for importable modules
comfy_env/workers/venv.py CHANGED
@@ -252,10 +252,29 @@ def _serialize_for_ipc(obj, visited=None):
252
252
  # Worker script template - minimal, runs in target venv
253
253
  _WORKER_SCRIPT = '''
254
254
  import sys
255
+ import os
255
256
  import json
256
257
  import traceback
257
258
  from types import SimpleNamespace
258
259
 
260
+ # On Windows, add DLL directories for proper library loading
261
+ if sys.platform == "win32" and hasattr(os, "add_dll_directory"):
262
+ _host_python_dir = os.environ.get("COMFYUI_HOST_PYTHON_DIR")
263
+ if _host_python_dir:
264
+ try:
265
+ os.add_dll_directory(_host_python_dir)
266
+ _dlls_dir = os.path.join(_host_python_dir, "DLLs")
267
+ if os.path.isdir(_dlls_dir):
268
+ os.add_dll_directory(_dlls_dir)
269
+ except Exception:
270
+ pass
271
+ _pixi_library_bin = os.environ.get("COMFYUI_PIXI_LIBRARY_BIN")
272
+ if _pixi_library_bin:
273
+ try:
274
+ os.add_dll_directory(_pixi_library_bin)
275
+ except Exception:
276
+ pass
277
+
259
278
  def _deserialize_isolated_objects(obj):
260
279
  """Reconstruct objects serialized with __isolated_object__ marker."""
261
280
  if isinstance(obj, dict):
@@ -475,12 +494,29 @@ class VenvWorker(Worker):
475
494
  env.update(self.extra_env)
476
495
  env["COMFYUI_ISOLATION_WORKER"] = "1"
477
496
 
478
- # For conda/pixi environments, add lib dir to LD_LIBRARY_PATH
497
+ # For conda/pixi environments, add lib dir to LD_LIBRARY_PATH (Linux)
479
498
  lib_dir = self.python.parent.parent / "lib"
480
499
  if lib_dir.is_dir():
481
500
  existing = env.get("LD_LIBRARY_PATH", "")
482
501
  env["LD_LIBRARY_PATH"] = f"{lib_dir}:{existing}" if existing else str(lib_dir)
483
502
 
503
+ # On Windows, pass host Python directory and pixi Library/bin for DLL loading
504
+ if sys.platform == "win32":
505
+ env["COMFYUI_HOST_PYTHON_DIR"] = str(Path(sys.executable).parent)
506
+
507
+ # For pixi environments with MKL, add Library/bin to PATH for DLL loading
508
+ # Pixi has python.exe directly in env dir, not in Scripts/
509
+ env_dir = self.python.parent
510
+ library_bin = env_dir / "Library" / "bin"
511
+ if library_bin.is_dir():
512
+ existing_path = env.get("PATH", "")
513
+ env["PATH"] = f"{env_dir};{library_bin};{existing_path}"
514
+ env["COMFYUI_PIXI_LIBRARY_BIN"] = str(library_bin)
515
+ # Allow duplicate OpenMP libraries (MKL's libiomp5md.dll + PyTorch's libomp.dll)
516
+ env["KMP_DUPLICATE_LIB_OK"] = "TRUE"
517
+ # Use UTF-8 encoding for stdout/stderr to handle Unicode symbols
518
+ env["PYTHONIOENCODING"] = "utf-8"
519
+
484
520
  # Run subprocess
485
521
  cmd = [
486
522
  str(self.python),
@@ -592,6 +628,15 @@ if sys.platform == "win32":
592
628
  except Exception:
593
629
  pass
594
630
 
631
+ # For pixi environments with MKL, add Library/bin for MKL DLLs
632
+ _pixi_library_bin = os.environ.get("COMFYUI_PIXI_LIBRARY_BIN")
633
+ if _pixi_library_bin and hasattr(os, "add_dll_directory"):
634
+ try:
635
+ os.add_dll_directory(_pixi_library_bin)
636
+ print(f"[worker] Added pixi Library/bin to DLL search: {_pixi_library_bin}", flush=True)
637
+ except Exception as e:
638
+ print(f"[worker] Failed to add pixi Library/bin: {e}", flush=True)
639
+
595
640
  # =============================================================================
596
641
  # Object Reference System - keep complex objects in worker, pass refs to host
597
642
  # =============================================================================
@@ -977,6 +1022,22 @@ class PersistentVenvWorker(Worker):
977
1022
  if sys.platform == "win32":
978
1023
  env["COMFYUI_HOST_PYTHON_DIR"] = str(Path(sys.executable).parent)
979
1024
 
1025
+ # For pixi environments with MKL, add Library/bin to PATH for DLL loading
1026
+ # MKL DLLs are in .pixi/envs/default/Library/bin/
1027
+ # Pixi has python.exe directly in env dir, not in Scripts/
1028
+ env_dir = self.python.parent
1029
+ library_bin = env_dir / "Library" / "bin"
1030
+ if library_bin.is_dir():
1031
+ existing_path = env.get("PATH", "")
1032
+ # Add env dir and Library/bin to PATH
1033
+ env["PATH"] = f"{env_dir};{library_bin};{existing_path}"
1034
+ # Also pass as env var so worker can use os.add_dll_directory()
1035
+ env["COMFYUI_PIXI_LIBRARY_BIN"] = str(library_bin)
1036
+ # Allow duplicate OpenMP libraries (MKL's libiomp5md.dll + PyTorch's libomp.dll)
1037
+ env["KMP_DUPLICATE_LIB_OK"] = "TRUE"
1038
+ # Use UTF-8 encoding for stdout/stderr to handle Unicode symbols
1039
+ env["PYTHONIOENCODING"] = "utf-8"
1040
+
980
1041
  # Find ComfyUI base and set env var for folder_paths stub
981
1042
  comfyui_base = self._find_comfyui_base()
982
1043
  if comfyui_base:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comfy-env
3
- Version: 0.0.51
3
+ Version: 0.0.52
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
@@ -5,10 +5,10 @@ comfy_env/errors.py,sha256=8hN8NDlo8oBUdapc-eT3ZluigI5VBzfqsSBvQdfWlz4,9943
5
5
  comfy_env/install.py,sha256=b2eXFqQ58pUBWpwc1AhymbTh7dGRMnEuq5FoZot0CO0,15661
6
6
  comfy_env/isolation.py,sha256=wuze8TmkRbdMfrg2cj9quoGYJWsxKcc5iiDvmLWX16g,8680
7
7
  comfy_env/nodes.py,sha256=CWUe35jU5SKk4ur-SddZePdqWgxJDlxGhpcJiu5pAK4,4354
8
- comfy_env/pixi.py,sha256=p3qP-4l95-toOI3-N2luJQ7kB-KLbalDB6yEJjmfzoc,19574
8
+ comfy_env/pixi.py,sha256=qycJVCwtxxG5a9w3TGiRX3sw_GcEsIiDEy9hu_H7loU,19765
9
9
  comfy_env/registry.py,sha256=w-QwvAPFlCrBYRAv4cXkp2zujQPZn8Fk5DUxKCtox8o,3430
10
10
  comfy_env/resolver.py,sha256=WoNIo2IfTR2RlEf_HQl66eAeMa2R2pmLof_UdK-0RNE,6714
11
- comfy_env/stub_imports.py,sha256=s84q8x5156ZkHNJhbuDqMhU_c-0ux51Rhe1aoVcGrj4,8920
11
+ comfy_env/stub_imports.py,sha256=9aSWkgDHU0GjqQ8BmUMJyKewc47OtlbWPbAYY0gkCrM,9274
12
12
  comfy_env/env/__init__.py,sha256=imQdoQEQvrRT-QDtyNpFlkVbm2fBzgACdpQwRPd09fI,1157
13
13
  comfy_env/env/config.py,sha256=cRSuWiVZGSK9xpvyNIyMirlHyfTm6_AB_eXzeKyvfnc,7749
14
14
  comfy_env/env/config_file.py,sha256=g6fZq6XbTUXx97meWW_7xfKcuC0sN002c7fBvR0eCOg,24819
@@ -39,10 +39,10 @@ comfy_env/workers/base.py,sha256=ZILYXlvGCWuCZXmjKqfG8VeD19ihdYaASdlbasl2BMo,231
39
39
  comfy_env/workers/pool.py,sha256=MtjeOWfvHSCockq8j1gfnxIl-t01GSB79T5N4YB82Lg,6956
40
40
  comfy_env/workers/tensor_utils.py,sha256=TCuOAjJymrSbkgfyvcKtQ_KbVWTqSwP9VH_bCaFLLq8,6409
41
41
  comfy_env/workers/torch_mp.py,sha256=TnsCoBHEJBXEoBkx7WiCd9tBAlzFtMOw1dk_7_zGJZY,22288
42
- comfy_env/workers/venv.py,sha256=MXN0KRlIPREEgJKM-4_sXHQw4Dv8hLFGohmway6y3UU,46393
42
+ comfy_env/workers/venv.py,sha256=IFeMaOyxTW3RXfc71Q1i_JhfE7ZBbTGm18Rr_KLI1cE,49606
43
43
  comfy_env/wheel_sources.yml,sha256=uU0YJmWaiLAicQNN9VYS8PZevlP2NOH6mBUE294dvAo,8156
44
- comfy_env-0.0.51.dist-info/METADATA,sha256=6DlmPszS1Q0lDXK1I0YXfkbaKPQyZKiZN7PsXQuVSHk,8735
45
- comfy_env-0.0.51.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
46
- comfy_env-0.0.51.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
47
- comfy_env-0.0.51.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
48
- comfy_env-0.0.51.dist-info/RECORD,,
44
+ comfy_env-0.0.52.dist-info/METADATA,sha256=afUGkDhRWskd-PWfDjXCHUUCqoMJNE9933-EV7JyDOg,8735
45
+ comfy_env-0.0.52.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
46
+ comfy_env-0.0.52.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
47
+ comfy_env-0.0.52.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
48
+ comfy_env-0.0.52.dist-info/RECORD,,