ModuleNotFoundError: No module named 'websockets.asyncio'

I tried searching in here and didn't see a similar post. The call was working to supabase a couple days ago but now it's not.

File "/user/src/app/src/config/supabase_config.py", line 1, in <module>
from supabase import create_client
File "/usr/local/lib/python3.13/site-packages/supabase/init.py", line 13, in <module>
from realtime import AuthorizationError, NotConnectedError
File "/usr/local/lib/python3.13/site-packages/realtime/init.py", line 9, in <module>
from ._async.client import AsyncRealtimeClient
File "/usr/local/lib/python3.13/site-packages/realtime/_async/client.py", line 13, in <module>
from websockets.asyncio.client import ClientConnection, connect
ModuleNotFoundError: No module named 'websockets.asyncio'
from supabase import create_client
import os
from functools import lru_cache
from dotenv import load_dotenv

Load environment variables at module level

load_dotenv()

@lru_cache()
def get_supabase_client():
"""
Creates and caches a Supabase client instance.
Uses lru_cache to ensure we only create one instance that can be reused.
"""


SUPABASE_URL = os.getenv("SUPABASE_URL")
SUPABASE_KEY = os.getenv("SUPABASE_SERVICE_ROLE_KEY")

if not SUPABASE_URL or not SUPABASE_KEY:
raise ValueError("Missing required Supabase environment variables")

return create_client(SUPABASE_URL, SUPABASE_KEY)
Was this page helpful?