toto10's picture
00a4ef3f9ad50e484da61893e60b77bb57629f7b9dd7d759346c4dda116cba15
a0611b0
raw
history blame
913 Bytes
import launch
import os
import pkg_resources
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
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
if installed_version != package_version:
launch.run_pip(f"install {package}", f"SD-CN-Animation 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-CN-Animation requirement: {package}")
except Exception as e:
print(e)
print(f'Warning: Failed to install {package}.')