diff --git a/__init__.py b/__init__.py index 78ae9fe..b1e2704 100644 --- a/__init__.py +++ b/__init__.py @@ -41,27 +41,4 @@ NODE_DISPLAY_NAME_MAPPINGS = { __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] -# install_model = ["python-slugify==8.0.1", "modelscope", "controlnet_aux==0.0.6", "onnxruntime==1.15.1", "mmcv==1.7.0", "mmdet==2.26.0", "mediapipe==0.10.3", "edge_tts"] -def handle_stream(stream, prefix): - for line in stream: - print(prefix, line, end="") - - -def run_script(cmd, cwd='.'): - process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) - stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, "")) - stderr_thread = threading.Thread(target=handle_stream, args=(process.stderr, "[!]")) - stdout_thread.start() - stderr_thread.start() - stdout_thread.join() - stderr_thread.join() - return process.wait() - - -if os.path.basename(parent_dir) == "custom_nodes": - print("## installing facechain dependencies") - requirements_path = os.path.join(root_path, "requirements.txt") - run_script([sys.executable, '-s', '-m', 'pip', 'install', '-q', '-r', requirements_path]) - # for model in install_model: - # run_script([sys.executable, '-s', '-m', 'pip', 'install', '-q', model]) diff --git a/facechain/utils/install.py b/facechain/utils/install.py index 78309d8..78db13b 100644 --- a/facechain/utils/install.py +++ b/facechain/utils/install.py @@ -8,10 +8,11 @@ import re from facechain.utils.config import root_path +plugin_name = os.path.basename(root_path) windows_not_install = ['mmcv_full\n'] def log(msg, end=None, file=None): - print('Portrait Maker ==============', msg, end=end, file=file) + print(f'{plugin_name} :', msg, end=end, file=file) def handle_stream(stream, is_stdout): stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace') @@ -23,7 +24,7 @@ def handle_stream(stream, is_stdout): log(msg, end="", file=sys.stderr) def process_wrap(cmd_str, cwd=None, handler=None): - log(f"[Portrait Maker] EXECUTE: {cmd_str} in '{cwd}'") + log(f"EXECUTE: {cmd_str} in '{cwd}'") process = subprocess.Popen(cmd_str, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) if handler is None: @@ -50,7 +51,7 @@ def get_installed_packages(): result = subprocess.check_output([sys.executable, '-m', 'pip', 'list'], universal_newlines=True) pip_list = set([line.split()[0].lower() for line in result.split('\n') if line.strip()]) except subprocess.CalledProcessError as e: - log(f"[ComfyUI-Manager] Failed to retrieve the information of installed pip packages.") + log(f"Failed to retrieve the information of installed pip packages.") return set() return pip_list @@ -89,7 +90,7 @@ def check_and_install_requirements(file_path): try: import platform - log("### ComfyUI-Portrait-Maker: Check dependencies") + log("### : Check dependencies") if "python_embed" in sys.executable or "python_embedded" in sys.executable: pip_install = [sys.executable, '-s', '-m', 'pip', 'install', '-q'] mim_install = [sys.executable, '-s', '-m', 'mim', 'install'] @@ -106,5 +107,5 @@ try: sys.path.append('..') # for portable version except Exception as e: - log("[ERROR] ComfyUI-Impact-Pack: Dependency installation has failed. Please install manually.") + log("Dependency installation has failed. Please install manually.") traceback.print_exc()