Restore package_exists

This commit is contained in:
bhack 2024-03-14 21:59:54 +01:00 committed by GitHub
parent 1941a44f74
commit 66fd2cd5c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,6 +46,7 @@ def _is_package_available(pkg_name: str, return_version: bool = False) -> Union[
try:
# Primary method to get the package version
package_version = importlib.metadata.version(pkg_name)
package_exists = True
except importlib.metadata.PackageNotFoundError:
# Fallback method: Only for "torch" and versions containing "dev"
if pkg_name == "torch":