Download custom_nodes/ComfyUI-to-Python-Extension/install.py from fotographerai/Zen-Style-Shape: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/c0e10ba394d17bfa21ed8e0eaaceacb3913487fe/custom_nodes/ComfyUI-to-Python-Extension/install.py
- Command line
-
hf download hf://spaces/fotographerai/Zen-Style-Shape@c0e10ba394d17bfa21ed8e0eaaceacb3913487fe/custom_nodes/ComfyUI-to-Python-Extension/install.py
-
curl -L -o install.py https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/c0e10ba394d17bfa21ed8e0eaaceacb3913487fe/custom_nodes/ComfyUI-to-Python-Extension/install.py
734 Bytes
| import os | |
| import sys | |
| from subprocess import Popen, check_output, PIPE | |
| requirements = open(os.path.join(os.path.dirname(__file__), "requirements.txt")).read().split("\n") | |
| installed_packages = check_output( | |
| [sys.executable, "-m", "pip", "list"], | |
| universal_newlines=True | |
| ).split("\n") | |
| installed_packages = set([package.split(" ")[0].lower() for package in installed_packages if package.strip()]) | |
| for requirement in requirements: | |
| if requirement.lower() not in installed_packages: | |
| print(f"Installing requirements...") | |
| Popen([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], stdout=PIPE, stderr=PIPE, cwd=os.path.dirname(__file__)).communicate() | |
| print(f"Installed.") | |
| break | |