Skip to content

Commit

Permalink
Fix 126 error issues
Browse files Browse the repository at this point in the history
- Add automatic uninstallation and installation of the correct version of third-party libraries to fix it AUTOMATIC1111#5 AUTOMATIC1111#12
- After repair, third-party one click integration packages can also be used
- At present, this solution can only be used, and the code is written with the assistance of GPT4
  • Loading branch information
huangjieqi authored Apr 18, 2023
1 parent 64821f0 commit 08008ea
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion install.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import launch
import pkg_resources

onnxruntime_version = "1.14.0"
required_version = pkg_resources.parse_version(onnxruntime_version)

if not launch.is_installed("rembg"):
launch.run_pip("install rembg==2.0.30 --no-deps", "rembg")

for dep in ['onnxruntime', 'pymatting', 'pooch']:
if launch.is_installed("onnxruntime"):
# Get installed version
installed_version = pkg_resources.get_distribution("onnxruntime").version
parsed_installed_version = pkg_resources.parse_version(installed_version)

# Uninstall onnxruntime if installed version is not the required version
if parsed_installed_version != required_version:
launch.run_pip(f"uninstall -y onnxruntime", "uninstall onnxruntime")

# Install the required version of onnxruntime
launch.run_pip(f"install onnxruntime=={onnxruntime_version}", f"onnxruntime {onnxruntime_version}")

for dep in ['pymatting', 'pooch']:
if not launch.is_installed(dep):
launch.run_pip(f"install {dep}", f"{dep} for REMBG extension")

0 comments on commit 08008ea

Please sign in to comment.