ModuleNotFoundError: No module named 'binance.websockets'

Hello Guys,

I am new here.

I am trying to connect Binance Websocket but always get the error below, What should I do?

from binance.websockets import BinanceSocketManager
ModuleNotFoundError: No module named ‘binance.websockets’

Any sugesstions? Many thanks

Hi. Without the details of your package used, there are two possible reasons. One is that the package is not properly installed in your local, the other is that the package itself indeed does not have that module. Please check the code from your side to see what is the root cause.

Hi,

I follow from this page step-by-step https://algotrading101.com/learn/binance-python-api-guide/?fbclid=IwAR1e_4xxCYv6kX8TjeVbTrNKPYiCmrG1FCO4u71jEhzRlwfJZWg5VROcaRo

but when I try to import the following

import os

from binance.client import Client
from binance.websockets import BinanceSocketManager
from twisted.internet import reactor

I got the error meg below

from binance.websockets import BinanceSocketManager
ModuleNotFoundError: No module named ‘binance.websockets’

How can I install websocket package in my local?

Ensure that pip install is done correctly. Also ensure that you do not have any filename called binance.py in your project.

Hi,

I already checked. There is not file named binance.py.

I have checked in site-packages > binance and found that there is no file names websockets.py

How can I install this file?

This file comes with the package when you do pip install python-binance.