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

replacing distutils.StrictVersion dependency for Python 3.12 #6938

Merged
merged 4 commits into from Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fruity-taxis-sit.md
@@ -0,0 +1,6 @@
---
"@gradio/wasm": patch
"gradio": patch
---

fix:replacing distutils.StrictVersion dependency for Python 3.12
4 changes: 2 additions & 2 deletions gradio/analytics.py
Expand Up @@ -7,7 +7,7 @@
import threading
import urllib.parse
import warnings
from distutils.version import StrictVersion
from packaging.version import Version
from typing import Any

import httpx
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion js/wasm/src/webworker/index.ts
Expand Up @@ -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.
Expand Down