mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-16 18:02:58 +08:00
fixed: invalid config.ini path
fixed: invalid environment setup for git_helper.py fixed: default pip overrides doesn't work modified: git_helper.py - use GIT_EXE_PATH env instead of config.ini improved: print user_directory and ComfyUI-Manager config path on startup
This commit is contained in:
parent
ac8804ca6a
commit
fd164862f3
@ -71,9 +71,8 @@ core.check_invalid_nodes()
|
|||||||
def read_downgrade_blacklist():
|
def read_downgrade_blacklist():
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(core.manager_config.path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
if 'downgrade_blacklist' in default_conf:
|
if 'downgrade_blacklist' in default_conf:
|
||||||
@ -136,9 +135,9 @@ class Ctx:
|
|||||||
core.update_user_directory(user_directory)
|
core.update_user_directory(user_directory)
|
||||||
|
|
||||||
if os.path.exists(core.manager_pip_overrides_path):
|
if os.path.exists(core.manager_pip_overrides_path):
|
||||||
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
|
||||||
with open(core.manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
|
with open(core.manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
|
||||||
cm_global.pip_overrides = json.load(json_file)
|
cm_global.pip_overrides = json.load(json_file)
|
||||||
|
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_startup_scripts_path():
|
def get_startup_scripts_path():
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import os
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import git
|
import git
|
||||||
import configparser
|
|
||||||
import json
|
import json
|
||||||
import yaml
|
import yaml
|
||||||
import requests
|
import requests
|
||||||
@ -13,13 +12,13 @@ from git.remote import RemoteProgress
|
|||||||
|
|
||||||
|
|
||||||
comfy_path = os.environ.get('COMFYUI_PATH')
|
comfy_path = os.environ.get('COMFYUI_PATH')
|
||||||
|
git_exe_path = os.environ.get('GIT_EXE_PATH')
|
||||||
|
|
||||||
if comfy_path is None:
|
if comfy_path is None:
|
||||||
print("\n[bold yellow]WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.[/bold yellow]", file=sys.stderr)
|
print("\nWARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.", file=sys.stderr)
|
||||||
comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_url(url, dest_folder, filename=None):
|
def download_url(url, dest_folder, filename=None):
|
||||||
# Ensure the destination folder exists
|
# Ensure the destination folder exists
|
||||||
if not os.path.exists(dest_folder):
|
if not os.path.exists(dest_folder):
|
||||||
@ -43,7 +42,6 @@ def download_url(url, dest_folder, filename=None):
|
|||||||
print(f"Failed to download file from {url}")
|
print(f"Failed to download file from {url}")
|
||||||
|
|
||||||
|
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
nodelist_path = os.path.join(os.path.dirname(__file__), "custom-node-list.json")
|
nodelist_path = os.path.join(os.path.dirname(__file__), "custom-node-list.json")
|
||||||
working_directory = os.getcwd()
|
working_directory = os.getcwd()
|
||||||
|
|
||||||
@ -440,10 +438,8 @@ def restore_pip_snapshot(pips, options):
|
|||||||
|
|
||||||
|
|
||||||
def setup_environment():
|
def setup_environment():
|
||||||
config = configparser.ConfigParser()
|
if git_exe_path is not None:
|
||||||
config.read(config_path)
|
git.Git().update_environment(GIT_PYTHON_GIT_EXECUTABLE=git_exe_path)
|
||||||
if 'default' in config and 'git_exe' in config['default'] and config['default']['git_exe'] != '':
|
|
||||||
git.Git().update_environment(GIT_PYTHON_GIT_EXECUTABLE=config['default']['git_exe'])
|
|
||||||
|
|
||||||
|
|
||||||
setup_environment()
|
setup_environment()
|
||||||
|
|||||||
@ -41,7 +41,7 @@ import manager_downloader
|
|||||||
from node_package import InstalledNodePackage
|
from node_package import InstalledNodePackage
|
||||||
|
|
||||||
|
|
||||||
version_code = [3, 4]
|
version_code = [3, 5]
|
||||||
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/ma
|
|||||||
|
|
||||||
default_custom_nodes_path = None
|
default_custom_nodes_path = None
|
||||||
|
|
||||||
|
|
||||||
def get_default_custom_nodes_path():
|
def get_default_custom_nodes_path():
|
||||||
global default_custom_nodes_path
|
global default_custom_nodes_path
|
||||||
if default_custom_nodes_path is None:
|
if default_custom_nodes_path is None:
|
||||||
@ -79,6 +80,16 @@ def get_comfyui_tag():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_script_env():
|
||||||
|
copied = os.environ.copy()
|
||||||
|
git_exe = get_config().get('git_exe')
|
||||||
|
if git_exe is not None:
|
||||||
|
copied['GIT_EXE_PATH'] = git_exe
|
||||||
|
copied['COMFYUI_PATH'] = comfy_path
|
||||||
|
|
||||||
|
return copied
|
||||||
|
|
||||||
|
|
||||||
invalid_nodes = {}
|
invalid_nodes = {}
|
||||||
|
|
||||||
|
|
||||||
@ -1480,9 +1491,7 @@ class ManagerFuncs:
|
|||||||
print(f"[ComfyUI-Manager] Unexpected behavior: `{cmd}`")
|
print(f"[ComfyUI-Manager] Unexpected behavior: `{cmd}`")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new_env = os.environ.copy()
|
subprocess.check_call(cmd, cwd=cwd, env=get_script_env())
|
||||||
new_env["COMFYUI_PATH"] = comfy_path
|
|
||||||
subprocess.check_call(cmd, cwd=cwd, env=new_env)
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@ -1639,9 +1648,8 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
|
|||||||
else:
|
else:
|
||||||
command = [sys.executable, git_script_path, "--check", path]
|
command = [sys.executable, git_script_path, "--check", path]
|
||||||
|
|
||||||
new_env = os.environ.copy()
|
new_env = get_script_env()
|
||||||
new_env["COMFYUI_PATH"] = comfy_path
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=get_default_custom_nodes_path(), env=new_env)
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=get_default_custom_nodes_path())
|
|
||||||
output, _ = process.communicate()
|
output, _ = process.communicate()
|
||||||
output = output.decode('utf-8').strip()
|
output = output.decode('utf-8').strip()
|
||||||
|
|
||||||
@ -1692,10 +1700,8 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
|
|||||||
|
|
||||||
|
|
||||||
def __win_check_git_pull(path):
|
def __win_check_git_pull(path):
|
||||||
new_env = os.environ.copy()
|
|
||||||
new_env["COMFYUI_PATH"] = comfy_path
|
|
||||||
command = [sys.executable, git_script_path, "--pull", path]
|
command = [sys.executable, git_script_path, "--pull", path]
|
||||||
process = subprocess.Popen(command, env=new_env, cwd=get_default_custom_nodes_path())
|
process = subprocess.Popen(command, env=get_script_env(), cwd=get_default_custom_nodes_path())
|
||||||
process.wait()
|
process.wait()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class ManagerFuncsInComfyUI(core.ManagerFuncs):
|
|||||||
logging.error(f"[ComfyUI-Manager] Unexpected behavior: `{cmd}`")
|
logging.error(f"[ComfyUI-Manager] Unexpected behavior: `{cmd}`")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1)
|
process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1, env=core.get_script_env())
|
||||||
|
|
||||||
stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, ""))
|
stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, ""))
|
||||||
stderr_thread = threading.Thread(target=handle_stream, args=(process.stderr, "[!]"))
|
stderr_thread = threading.Thread(target=handle_stream, args=(process.stderr, "[!]"))
|
||||||
|
|||||||
@ -50,9 +50,8 @@ def check_file_logging():
|
|||||||
global enable_file_logging
|
global enable_file_logging
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(manager_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
if 'file_logging' in default_conf and default_conf['file_logging'].lower() == 'false':
|
if 'file_logging' in default_conf and default_conf['file_logging'].lower() == 'false':
|
||||||
@ -79,12 +78,12 @@ custom_nodes_base_path = folder_paths.get_folder_paths('custom_nodes')[0]
|
|||||||
manager_files_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'ComfyUI-Manager'))
|
manager_files_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'ComfyUI-Manager'))
|
||||||
manager_pip_overrides_path = os.path.join(manager_files_path, "pip_overrides.json")
|
manager_pip_overrides_path = os.path.join(manager_files_path, "pip_overrides.json")
|
||||||
restore_snapshot_path = os.path.join(manager_files_path, "startup-scripts", "restore-snapshot.json")
|
restore_snapshot_path = os.path.join(manager_files_path, "startup-scripts", "restore-snapshot.json")
|
||||||
|
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
||||||
|
|
||||||
git_script_path = os.path.join(comfyui_manager_path, "git_helper.py")
|
|
||||||
cm_cli_path = os.path.join(comfyui_manager_path, "cm-cli.py")
|
cm_cli_path = os.path.join(comfyui_manager_path, "cm-cli.py")
|
||||||
|
|
||||||
|
|
||||||
cm_global.pip_overrides = {}
|
cm_global.pip_overrides = {'numpy': 'numpy<2', 'ultralytics': 'ultralytics==8.3.40'}
|
||||||
if os.path.exists(manager_pip_overrides_path):
|
if os.path.exists(manager_pip_overrides_path):
|
||||||
with open(manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
|
with open(manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
|
||||||
cm_global.pip_overrides = json.load(json_file)
|
cm_global.pip_overrides = json.load(json_file)
|
||||||
@ -345,6 +344,9 @@ print("** Platform:", platform.system())
|
|||||||
print("** Python version:", sys.version)
|
print("** Python version:", sys.version)
|
||||||
print("** Python executable:", sys.executable)
|
print("** Python executable:", sys.executable)
|
||||||
print("** ComfyUI Path:", comfy_path)
|
print("** ComfyUI Path:", comfy_path)
|
||||||
|
print("** User directory:", folder_paths.user_directory)
|
||||||
|
print("** ComfyUI-Manager config path:", manager_config_path)
|
||||||
|
|
||||||
|
|
||||||
if log_path_base is not None:
|
if log_path_base is not None:
|
||||||
print("** Log path:", os.path.abspath(f'{log_path_base}.log'))
|
print("** Log path:", os.path.abspath(f'{log_path_base}.log'))
|
||||||
@ -355,9 +357,8 @@ else:
|
|||||||
def read_downgrade_blacklist():
|
def read_downgrade_blacklist():
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(manager_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
if 'downgrade_blacklist' in default_conf:
|
if 'downgrade_blacklist' in default_conf:
|
||||||
@ -376,13 +377,12 @@ def check_bypass_ssl():
|
|||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
import ssl
|
import ssl
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(manager_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
if 'bypass_ssl' in default_conf and default_conf['bypass_ssl'].lower() == 'true':
|
if 'bypass_ssl' in default_conf and default_conf['bypass_ssl'].lower() == 'true':
|
||||||
print("[ComfyUI-Manager] WARN: Unsafe - SSL verification bypass option is Enabled. (see ComfyUI-Manager/config.ini)")
|
print(f"[ComfyUI-Manager] WARN: Unsafe - SSL verification bypass option is Enabled. (see {manager_config_path})")
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context # SSL certificate error fix.
|
ssl._create_default_https_context = ssl._create_unverified_context # SSL certificate error fix.
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@ -648,9 +648,8 @@ manager_util.clear_pip_cache()
|
|||||||
def check_windows_event_loop_policy():
|
def check_windows_event_loop_policy():
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(manager_config_path)
|
||||||
default_conf = config['default']
|
default_conf = config['default']
|
||||||
|
|
||||||
if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
|
if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
name = "comfyui-manager"
|
||||||
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
version = "3.4"
|
version = "3.5"
|
||||||
license = { file = "LICENSE.txt" }
|
license = { file = "LICENSE.txt" }
|
||||||
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user