Uvicorn dependency issue

I want to create a Django webserver capable of handling HTTP requests and WebSocket requests. I am using uvicorn so that both types of requests can be handled in the same server instance. Whenever I try to launch my server with the command:

uvicorn core.asgi:application --host 0.0.0.0 --port 8000

I get the error message:

python3.11/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 11, in import websockets.legacy.handshake ModuleNotFoundError: No module named 'websockets.legacy'

Here is my conda file:

name: [env-name] channels:

  • conda-forge
  • defaults dependencies:
  • channels
  • python=3.11
  • daphne
  • django
  • djangorestframework
  • uvicorn
  • boto3
  • pip
  • pip:
    • django-cors-headers
    • websockets
    • "uvicorn[standard]"

I'm not sure why this is happening.

I've tried pip installing all of the dependencies, reinstalling the virtual environment, but it always says "Requirement Already Satisfied".

Вернуться на верх