Websocket error in my consumers

First, you don’t need to delete packages yourself. Pip will properly install a different version of a package by uninstalling the original package first.

Given that most of the version differences I see show your production server as having newer versions of libraries than your local environment, you need to make a choice. You need to decide what your ultimate objective is.

If you consider this project to be a “dead-end” effort, you may just want to find the quickest answer and move on.

However, if this is something you’re looking to keep around for a while, you may want to spend the time now to understand what is going wrong.

I would suggest:

  • Identify which libraries you have installed in production that are a different version than what you have installed locally.

  • Identify which of those libraries are being used (directly and indirectly to the best that you know) in your Consumer.

  • Try to order that list in order of “reliability”, check the more “questionable” third-party libraries first. (Yes, that’s very much a judgement call.)

  • If you’re using a virtual environment for your project, use pip to install the same specific version of those libraries as what you have installed in your local environment.

    • If you do this one-by-one, one library at a time, you can identify which library is causing the problem.
  • If you’re using the system-level Python environment for your project (not a good choice, but it can be done), I’d recommend switching to using a virtual environment.

or

You could do a pip freeze of your local environment to make a requirements file replicating your local environment and use pip install of that file in your production server.

or

You might want to create another virtual environment locally with the versions of the packages that are installed in production to see if you get the same errors in your local environment.