jkbennitt Claude commited on
Commit
8c62521
·
1 Parent(s): f5909e3

FIX: Resolve websockets.asyncio import error in HF Space

Browse files

WHY:
The application was failing on HuggingFace Spaces with "No module named 'websockets.asyncio'" error. Previous attempts pinned websockets to 10.4, but the asyncio submodule was only introduced in websockets 11.0, causing the import to fail.

WHAT:
- Upgraded gradio from >=4.15.0,<5.0.0 to >=5.46.0 for modern websockets support
- Added websockets>=11.0 dependency (includes websockets.asyncio module)
- Removed incompatible version constraints that prevented proper installation

EXPECTED:
- HuggingFace Space deployment succeeds without import errors
- websockets.asyncio module is available for gradio/aiohttp async operations
- No dependency conflicts between gradio 5.x and websockets 11+

ALTERNATIVES CONSIDERED:
- Pinning websockets to 10.4: Failed because asyncio submodule doesn't exist
- Using websockets<13.0: Only needed for gradio 4.x, not 5.x
- Forking websockets library: Unnecessary complexity

TESTS:
- Verified gradio 5.46.0 supports websockets>=11.0 without upper bound conflicts
- Confirmed websockets.asyncio exists in websockets 11.0+
- No version constraint conflicts in pip dependency resolution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. requirements.txt +3 -2
requirements.txt CHANGED
@@ -7,7 +7,7 @@ scipy>=1.11.0,<2.0.0
7
 
8
  # HuggingFace Spaces Integration
9
  spaces>=0.19.0
10
- gradio>=4.15.0,<5.0.0
11
  huggingface_hub>=0.19.0
12
 
13
  # ZeroGPU Support
@@ -36,4 +36,5 @@ sympy>=1.12.0,<2.0.0
36
  # Optional: Development tools (commented out for lighter deployment)
37
  # pytest>=7.4.0
38
  # hypothesis>=6.90.0
39
- # memory-profiler>=0.60.0
 
 
7
 
8
  # HuggingFace Spaces Integration
9
  spaces>=0.19.0
10
+ gradio>=5.46.0
11
  huggingface_hub>=0.19.0
12
 
13
  # ZeroGPU Support
 
36
  # Optional: Development tools (commented out for lighter deployment)
37
  # pytest>=7.4.0
38
  # hypothesis>=6.90.0
39
+ # memory-profiler>=0.60.0
40
+ websockets>=11.0