Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Add dependency on opencv 4.8.0 #1899

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
import launch
import os
import pkg_resources
from typing import Tuple, Optional

req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")


def comparable_version(version: str) -> Tuple:
return tuple(version.split('.'))


def get_installed_version(package: str) -> Optional[str]:
try:
return pkg_resources.get_distribution(package).version
except Exception:
return None


with open(req_file) as file:
for package in file:
try:
package = package.strip()
if '==' in package:
package_name, package_version = package.split('==')
installed_version = pkg_resources.get_distribution(package_name).version
installed_version = get_installed_version(package_name)
if installed_version != package_version:
launch.run_pip(f"install {package}", f"sd-webui-controlnet requirement: changing {package_name} version from {installed_version} to {package_version}")
launch.run_pip(f"install -U {package}", f"sd-webui-controlnet requirement: changing {package_name} version from {installed_version} to {package_version}")
elif '>=' in package:
package_name, package_version = package.split('>=')
installed_version = get_installed_version(package_name)
if not installed_version or comparable_version(installed_version) < comparable_version(package_version):
launch.run_pip(f"install -U {package}", f"sd-webui-controlnet requirement: changing {package_name} version from {installed_version} to {package_version}")
elif not launch.is_installed(package):
launch.run_pip(f"install {package}", f"sd-webui-controlnet requirement: {package}")
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mediapipe
svglib
fvcore
opencv-python>=4.8.0