mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-15 01:27:05 +08:00
feat: custom pip_blacklist
https://github.com/ltdrdata/ComfyUI-Manager/issues/1560
This commit is contained in:
parent
3d883ca37d
commit
36f48b8656
@ -149,6 +149,7 @@ In `ComfyUI-Manager` V3.0 and later, configuration files and dynamically generat
|
|||||||
* Basic config files: `<USER_DIRECTORY>/default/ComfyUI-Manager/config.ini`
|
* Basic config files: `<USER_DIRECTORY>/default/ComfyUI-Manager/config.ini`
|
||||||
* Configurable channel lists: `<USER_DIRECTORY>/default/ComfyUI-Manager/channels.ini`
|
* Configurable channel lists: `<USER_DIRECTORY>/default/ComfyUI-Manager/channels.ini`
|
||||||
* Configurable pip overrides: `<USER_DIRECTORY>/default/ComfyUI-Manager/pip_overrides.json`
|
* Configurable pip overrides: `<USER_DIRECTORY>/default/ComfyUI-Manager/pip_overrides.json`
|
||||||
|
* Configurable pip blacklist: `<USER_DIRECTORY>/default/ComfyUI-Manager/pip_overrides.list`
|
||||||
* Saved snapshot files: `<USER_DIRECTORY>/default/ComfyUI-Manager/snapshots`
|
* Saved snapshot files: `<USER_DIRECTORY>/default/ComfyUI-Manager/snapshots`
|
||||||
* Startup script files: `<USER_DIRECTORY>/default/ComfyUI-Manager/startup-scripts`
|
* Startup script files: `<USER_DIRECTORY>/default/ComfyUI-Manager/startup-scripts`
|
||||||
* Component files: `<USER_DIRECTORY>/default/ComfyUI-Manager/components`
|
* Component files: `<USER_DIRECTORY>/default/ComfyUI-Manager/components`
|
||||||
@ -301,7 +302,10 @@ The following settings are applied based on the section marked as `is_default`.
|
|||||||
* Custom pip mapping
|
* Custom pip mapping
|
||||||
* When you create the `pip_overrides.json` file, it changes the installation of specific pip packages to installations defined by the user.
|
* When you create the `pip_overrides.json` file, it changes the installation of specific pip packages to installations defined by the user.
|
||||||
* Please refer to the `pip_overrides.json.template` file.
|
* Please refer to the `pip_overrides.json.template` file.
|
||||||
|
|
||||||
|
* Prevent the installation of specific pip packages
|
||||||
|
* List the package names one per line in the `pip_blacklist.list` file.
|
||||||
|
|
||||||
* Use `aria2` as downloader
|
* Use `aria2` as downloader
|
||||||
* [howto](docs/en/use_aria2.md)
|
* [howto](docs/en/use_aria2.md)
|
||||||
|
|
||||||
|
|||||||
17
cm-cli.py
17
cm-cli.py
@ -43,7 +43,7 @@ import cnr_utils
|
|||||||
|
|
||||||
comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
|
comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
cm_global.pip_blacklist = ['torch', 'torchsde', 'torchvision']
|
cm_global.pip_blacklist = {'torch', 'torchsde', 'torchvision'}
|
||||||
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
|
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
|
||||||
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
||||||
|
|
||||||
@ -52,6 +52,14 @@ if os.path.exists(os.path.join(manager_util.comfyui_manager_path, "pip_overrides
|
|||||||
cm_global.pip_overrides = json.load(json_file)
|
cm_global.pip_overrides = json.load(json_file)
|
||||||
|
|
||||||
|
|
||||||
|
if os.path.exists(os.path.join(manager_util.comfyui_manager_path, "pip_blacklist.list")):
|
||||||
|
with open(os.path.join(manager_util.comfyui_manager_path, "pip_blacklist.list"), 'r', encoding="UTF-8", errors="ignore") as f:
|
||||||
|
for x in f.readlines():
|
||||||
|
y = x.strip()
|
||||||
|
if y != '':
|
||||||
|
cm_global.pip_blacklist.add(y)
|
||||||
|
|
||||||
|
|
||||||
def check_comfyui_hash():
|
def check_comfyui_hash():
|
||||||
repo = git.Repo(comfy_path)
|
repo = git.Repo(comfy_path)
|
||||||
core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
|
core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
|
||||||
@ -137,6 +145,13 @@ class Ctx:
|
|||||||
cm_global.pip_overrides = json.load(json_file)
|
cm_global.pip_overrides = json.load(json_file)
|
||||||
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
cm_global.pip_overrides = {'numpy': 'numpy<2'}
|
||||||
|
|
||||||
|
if os.path.exists(core.manager_pip_blacklist_path):
|
||||||
|
with open(core.manager_pip_blacklist_path, 'r', encoding="UTF-8", errors="ignore") as f:
|
||||||
|
for x in f.readlines():
|
||||||
|
y = x.strip()
|
||||||
|
if y != '':
|
||||||
|
cm_global.pip_blacklist.add(y)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_startup_scripts_path():
|
def get_startup_scripts_path():
|
||||||
return os.path.join(core.manager_startup_script_path, "install-scripts.txt")
|
return os.path.join(core.manager_startup_script_path, "install-scripts.txt")
|
||||||
|
|||||||
@ -42,7 +42,7 @@ import manager_downloader
|
|||||||
from node_package import InstalledNodePackage
|
from node_package import InstalledNodePackage
|
||||||
|
|
||||||
|
|
||||||
version_code = [3, 22, 2]
|
version_code = [3, 23]
|
||||||
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 '')
|
||||||
|
|
||||||
|
|
||||||
@ -177,6 +177,7 @@ manager_channel_list_path = None
|
|||||||
manager_startup_script_path:str = None
|
manager_startup_script_path:str = None
|
||||||
manager_snapshot_path = None
|
manager_snapshot_path = None
|
||||||
manager_pip_overrides_path = None
|
manager_pip_overrides_path = None
|
||||||
|
manager_pip_blacklist_path = None
|
||||||
manager_components_path = None
|
manager_components_path = None
|
||||||
|
|
||||||
def update_user_directory(user_dir):
|
def update_user_directory(user_dir):
|
||||||
@ -186,6 +187,7 @@ def update_user_directory(user_dir):
|
|||||||
global manager_startup_script_path
|
global manager_startup_script_path
|
||||||
global manager_snapshot_path
|
global manager_snapshot_path
|
||||||
global manager_pip_overrides_path
|
global manager_pip_overrides_path
|
||||||
|
global manager_pip_blacklist_path
|
||||||
global manager_components_path
|
global manager_components_path
|
||||||
|
|
||||||
manager_files_path = os.path.abspath(os.path.join(user_dir, 'default', 'ComfyUI-Manager'))
|
manager_files_path = os.path.abspath(os.path.join(user_dir, 'default', 'ComfyUI-Manager'))
|
||||||
@ -203,6 +205,7 @@ def update_user_directory(user_dir):
|
|||||||
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
||||||
manager_channel_list_path = os.path.join(manager_files_path, 'channels.list')
|
manager_channel_list_path = os.path.join(manager_files_path, 'channels.list')
|
||||||
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")
|
||||||
|
manager_pip_blacklist_path = os.path.join(manager_files_path, "pip_blacklist.list")
|
||||||
manager_components_path = os.path.join(manager_files_path, "components")
|
manager_components_path = os.path.join(manager_files_path, "components")
|
||||||
manager_util.cache_dir = os.path.join(manager_files_path, "cache")
|
manager_util.cache_dir = os.path.join(manager_files_path, "cache")
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ else:
|
|||||||
|
|
||||||
security_check.security_check()
|
security_check.security_check()
|
||||||
|
|
||||||
cm_global.pip_blacklist = ['torch', 'torchsde', 'torchvision']
|
cm_global.pip_blacklist = {'torch', 'torchsde', 'torchvision'}
|
||||||
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
|
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
|
||||||
|
|
||||||
|
|
||||||
@ -82,6 +82,7 @@ comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
|
|||||||
custom_nodes_base_path = folder_paths.get_folder_paths('custom_nodes')[0]
|
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")
|
||||||
|
manager_pip_blacklist_path = os.path.join(manager_files_path, "pip_blacklist.list")
|
||||||
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')
|
manager_config_path = os.path.join(manager_files_path, 'config.ini')
|
||||||
|
|
||||||
@ -122,6 +123,14 @@ if os.path.exists(manager_pip_overrides_path):
|
|||||||
cm_global.pip_overrides['ultralytics'] = 'ultralytics==8.3.40' # for security
|
cm_global.pip_overrides['ultralytics'] = 'ultralytics==8.3.40' # for security
|
||||||
|
|
||||||
|
|
||||||
|
if os.path.exists(manager_pip_blacklist_path):
|
||||||
|
with open(manager_pip_blacklist_path, 'r', encoding="UTF-8", errors="ignore") as f:
|
||||||
|
for x in f.readlines():
|
||||||
|
y = x.strip()
|
||||||
|
if y != '':
|
||||||
|
cm_global.pip_blacklist.add(y)
|
||||||
|
|
||||||
|
|
||||||
def remap_pip_package(pkg):
|
def remap_pip_package(pkg):
|
||||||
if pkg in cm_global.pip_overrides:
|
if pkg in cm_global.pip_overrides:
|
||||||
res = cm_global.pip_overrides[pkg]
|
res = cm_global.pip_overrides[pkg]
|
||||||
|
|||||||
@ -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.22.2"
|
version = "3.23"
|
||||||
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"]
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ python -m venv venv
|
|||||||
call venv/Scripts/activate
|
call venv/Scripts/activate
|
||||||
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
|
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
python -m pip install -r custom_nodes/ComfyUI-Manager/requirements.txt
|
python -m pip install -r custom_nodes/comfyui-manager/requirements.txt
|
||||||
cd ..
|
cd ..
|
||||||
echo "cd ComfyUI" >> run_gpu.bat
|
echo "cd ComfyUI" >> run_gpu.bat
|
||||||
echo "call venv/Scripts/activate" >> run_gpu.bat
|
echo "call venv/Scripts/activate" >> run_gpu.bat
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
.\python_embeded\python.exe -s -m pip install gitpython
|
.\python_embeded\python.exe -s -m pip install gitpython
|
||||||
.\python_embeded\python.exe -c "import git; git.Repo.clone_from('https://github.com/ltdrdata/ComfyUI-Manager', './ComfyUI/custom_nodes/comfyui-manager')"
|
.\python_embeded\python.exe -c "import git; git.Repo.clone_from('https://github.com/ltdrdata/ComfyUI-Manager', './ComfyUI/custom_nodes/comfyui-manager')"
|
||||||
|
.\python_embeded\python.exe -m pip install -r ./ComfyUI/custom_nodes/comfyui-manager/requirements.txt
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user