@@ -141,28 +141,34 @@ def install_dependencies(
141141 workspace : Path ,
142142 verbose : int = 0 ,
143143 no_deps : bool = False ,
144+ no_venv : bool = False ,
144145):
145146 print ("Installing Python dependencies" )
146147 stdout = None if verbose > 0 else subprocess .DEVNULL
147148 stderr = None if verbose > 1 else subprocess .DEVNULL
148-
149- venv = workspace / ".venv"
150- if (venv / "DONE" ).exists ():
151- return
152- venv_py = (
153- venv / "Scripts" / "python.exe" if os .name == "nt" else venv / "bin" / "python"
154- )
155- subprocess .check_call (
156- [
157- "uv" ,
158- "venv" ,
159- "--python" ,
160- python_version ,
161- venv ,
162- ],
163- stdout = stdout ,
164- stderr = stderr ,
165- )
149+ if no_venv :
150+ print ("Using the current Python environment" )
151+ venv_py = Path (sys .executable )
152+ else :
153+ venv = workspace / ".venv"
154+ if (venv / "DONE" ).exists ():
155+ return
156+ venv_py = (
157+ venv / "Scripts" / "python.exe"
158+ if os .name == "nt"
159+ else venv / "bin" / "python"
160+ )
161+ subprocess .check_call (
162+ [
163+ "uv" ,
164+ "venv" ,
165+ "--python" ,
166+ python_version ,
167+ venv ,
168+ ],
169+ stdout = stdout ,
170+ stderr = stderr ,
171+ )
166172 subprocess .check_call (
167173 [
168174 "uv" ,
@@ -403,6 +409,7 @@ def install(
403409 preheat : bool = True ,
404410 prepare_models : bool = True ,
405411 all_models : bool = False ,
412+ no_venv : bool = False ,
406413 verbose : int = 0 ,
407414):
408415 workspace = Path (workspace )
@@ -427,6 +434,7 @@ def install(
427434 snapshot ["python" ],
428435 str (workspace / "requirements.txt" ),
429436 workspace ,
437+ no_venv = no_venv ,
430438 verbose = verbose ,
431439 )
432440 shutil .copy2 (
@@ -453,7 +461,7 @@ def install(
453461 with ComfyUIServer (
454462 str (workspace ),
455463 verbose = verbose ,
456- venv = str (workspace / ".venv" ),
464+ venv = str (workspace / ".venv" ) if not no_venv else None ,
457465 ) as _ :
458466 pass
459467 if prepare_models :
0 commit comments