Skip to content

Commit

Permalink
fix: 🔥 manage pip from install only, remove requirements.txt (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass authored Jul 29, 2023
1 parent 9b24edd commit 247fbfb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: 📦 Building and Bundling wheels
shell: bash
run: |
python -m pip wheel --no-cache-dir -r requirements-wheels.txt -w ./wheels 2>&1 | tee build.log
python -m pip wheel --no-cache-dir -r reqs.txt -w ./wheels 2>&1 | tee build.log
# find source wheels
packages=$(cat build.log | awk -F 'Building wheels for collected packages: ' '{print $2}')
Expand Down
4 changes: 2 additions & 2 deletions INSTALL-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ python scripts/download_models.py
1. 确保您处于用于 ComfyUI 的 Python 环境中。
2. 运行以下命令安装所需的依赖项:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```

</details>
Expand Down Expand Up @@ -77,7 +77,7 @@ python scripts/download_models.py
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```

如果运行后 colab 抱怨需要重新启动运行时,请重新启动,然后不要重新运行之前的单元格,只运行运行本地隧道的单元格。(可能需要先添加一个包含 `%cd ComfyUI` 的单元格)
Expand Down
4 changes: 2 additions & 2 deletions INSTALL-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ python scripts/download_models.py
1. ComfyUIで使用しているPython環境であることを確認してください。
2. 以下のコマンドを実行して、必要な依存関係をインストールします:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```

</details>
Expand All @@ -78,7 +78,7 @@ ComfyUI with localtunnel (Recommended Way)**ヘッダーのすぐ後(コード
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```
これを実行した後、colabがランタイムを再起動する必要があると文句を言ったら、それを実行し、それ以前のセルは再実行せず、localtunnelを実行するセルだけを再実行してください。(最初に`%cd ComfyUI`のセルを追加する必要があるかもしれません...)

Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ On first run the script [tries to symlink](https://github.com/melMass/comfy_mtb/
1. Make sure you are in the Python environment you use for ComfyUI.
2. Install the required dependencies by running the following command:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```

</details>
Expand Down Expand Up @@ -76,7 +76,7 @@ Add a new code cell just after the **Run ComfyUI with localtunnel (Recommended W
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```
If after running this, colab complains about needing to restart runtime, do it, and then do not rerun earlier cells, just the one to run the localtunnel. (you might have to add a cell with `%cd ComfyUI` first...)
Expand Down
23 changes: 10 additions & 13 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,16 @@ def import_or_install(requirement, dry=False):

# Install dependencies from requirements.txt
def install_dependencies(dry=False):
parsed_requirements = get_requirements(here / "requirements.txt")
parsed_requirements = get_requirements(here / "reqs.txt")
if not parsed_requirements:
return
print_formatted(
"Installing dependencies from requirements.txt...", "italic", color="yellow"
"Installing dependencies from reqs.txt...", "italic", color="yellow"
)

for requirement in parsed_requirements:
import_or_install(requirement, dry=dry)

if mode == "venv":
parsed_requirements = get_requirements(here / "requirements-wheels.txt")
if not parsed_requirements:
return
for requirement in parsed_requirements:
import_or_install(requirement, dry=dry)


if __name__ == "__main__":
full = False
Expand Down Expand Up @@ -328,14 +321,15 @@ def install_dependencies(dry=False):

# Install dependencies from requirements.txt
# if args.requirements or mode == "venv":
install_dependencies(dry=args.dry)

if (not args.wheels and mode not in ["colab", "embeded"]) and not full:
print_formatted(
"Skipping wheel installation. Use --wheels to install wheel dependencies. (only needed for Comfy embed)",
"italic",
color="yellow",
)

install_dependencies(dry=args.dry)
sys.exit()

if mode in ["colab", "embeded"]:
Expand All @@ -349,7 +343,7 @@ def install_dependencies(dry=False):

# - Check the env before proceeding.
missing_wheels = False
parsed_requirements = get_requirements(here / "requirements-wheels.txt")
parsed_requirements = get_requirements(here / "reqs.txt")
if parsed_requirements:
for requirement in parsed_requirements:
installed, pip_name, import_name = try_import(requirement)
Expand All @@ -359,7 +353,7 @@ def install_dependencies(dry=False):

if not missing_wheels:
print_formatted(
f"All required wheels are already installed.", "italic", color="green"
f"All requirements are already installed.", "italic", color="green"
)
sys.exit()

Expand Down Expand Up @@ -408,7 +402,7 @@ def install_dependencies(dry=False):
)

wheels_directory.mkdir(exist_ok=True)

# - Install the wheels
for asset in matching_assets:
asset_name = asset["name"]
asset_download_url = asset["browser_download_url"]
Expand Down Expand Up @@ -487,3 +481,6 @@ def install_dependencies(dry=False):
print_formatted("Wheels installation completed.", color="green")
else:
print_formatted("No .whl files found. Nothing to install.", color="yellow")

# - Install all remainings
install_dependencies(dry=args.dry)
3 changes: 3 additions & 0 deletions requirements.txt → reqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ protobuf==3.20.2; platform_system == "Windows"
gdown @ git+https://github.com/melMass/gdown@main
mmdet==3.0.0
facexlib==0.3.0
insightface==0.7.3
mmcv==2.0.0
basicsr==1.4.2
3 changes: 0 additions & 3 deletions requirements-wheels.txt

This file was deleted.

0 comments on commit 247fbfb

Please sign in to comment.