Skip to content

Conversation

@huangjieqi
Copy link

  • Add automatic uninstallation and installation of the correct version of third-party libraries to fix it #5` #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

- 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
Comment on lines +10 to +20
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}")
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants