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

Fix 126 error issues #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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}")
Comment on lines +10 to +20
Copy link

@missionfloyd missionfloyd Apr 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}")
# Install the required version of onnxruntime
launch.run_pip("install onnxruntime==1.14.0", "onnxruntime")

Don't need to uninstall the old version first, it does that automatically.


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