diff --git a/.changeset/fruity-taxis-sit.md b/.changeset/fruity-taxis-sit.md new file mode 100644 index 0000000000..96bd2a5792 --- /dev/null +++ b/.changeset/fruity-taxis-sit.md @@ -0,0 +1,6 @@ +--- +"@gradio/wasm": patch +"gradio": patch +--- + +fix:replacing distutils.StrictVersion dependency for Python 3.12 diff --git a/gradio/analytics.py b/gradio/analytics.py index 626ddfa2ab..b318b4d674 100644 --- a/gradio/analytics.py +++ b/gradio/analytics.py @@ -7,7 +7,7 @@ import os import threading import urllib.parse import warnings -from distutils.version import StrictVersion +from packaging.version import Version from typing import Any import httpx @@ -88,7 +88,7 @@ def version_check(): try: current_pkg_version = get_package_version() latest_pkg_version = httpx.get(url=PKG_VERSION_URL, timeout=3).json()["version"] - if StrictVersion(latest_pkg_version) > StrictVersion(current_pkg_version): + if Version(latest_pkg_version) > Version(current_pkg_version): print( f"IMPORTANT: You are using gradio version {current_pkg_version}, " f"however version {latest_pkg_version} is available, please upgrade." diff --git a/js/wasm/src/webworker/index.ts b/js/wasm/src/webworker/index.ts index de6679591c..046d4417a3 100644 --- a/js/wasm/src/webworker/index.ts +++ b/js/wasm/src/webworker/index.ts @@ -75,7 +75,7 @@ async function initializeEnvironment( updateProgress("Loading Gradio wheels"); await micropip.add_mock_package("ffmpy", "0.3.0"); await micropip.add_mock_package("aiohttp", "3.8.4"); - await pyodide.loadPackage(["ssl", "distutils", "setuptools"]); + await pyodide.loadPackage(["ssl", "setuptools"]); await micropip.install(["typing-extensions>=4.8.0"]); // Typing extensions needs to be installed first otherwise the versions from the pyodide lockfile is used which is incompatible with the latest fastapi. await micropip.install(["markdown-it-py[linkify]~=2.2.0"]); // On 3rd June 2023, markdown-it-py 3.0.0 has been released. The `gradio` package depends on its `>=2.0.0` version so its 3.x will be resolved. However, it conflicts with `mdit-py-plugins`'s dependency `markdown-it-py >=1.0.0,<3.0.0` and micropip currently can't resolve it. So we explicitly install the compatible version of the library here. await micropip.install(["anyio==3.*"]); // `fastapi` depends on `anyio>=3.4.0,<5` so its 4.* can be installed, but it conflicts with the anyio version `httpx` depends on, `==3.*`. Seems like micropip can't resolve it for now, so we explicitly install the compatible version of the library here.