Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: ModuleNotFoundError: No module named 'websockets.protocol' #239

Open
ivanrulik opened this issue May 10, 2021 · 8 comments · May be fixed by #241
Open

Issue: ModuleNotFoundError: No module named 'websockets.protocol' #239

ivanrulik opened this issue May 10, 2021 · 8 comments · May be fixed by #241

Comments

@ivanrulik
Copy link

I had used previously hbmqtt but now I'm getting this error always:

from hbmqtt.broker import Broker
File "/Users/ivanrulik/env/work1/lib/python3.8/site-packages/hbmqtt/broker.py", line 15, in
from hbmqtt.session import Session
File "/Users/ivanrulik/env/work1/lib/python3.8/site-packages/hbmqtt/session.py", line 8, in
from hbmqtt.mqtt.publish import PublishPacket
File "/Users/ivanrulik/env/work1/lib/python3.8/site-packages/hbmqtt/mqtt/init.py", line 5, in
from hbmqtt.mqtt.packet import (
File "/Users/ivanrulik/env/work1/lib/python3.8/site-packages/hbmqtt/mqtt/packet.py", line 8, in
from hbmqtt.adapters import ReaderAdapter, WriterAdapter
File "/Users/ivanrulik/env/work1/lib/python3.8/site-packages/hbmqtt/adapters.py", line 6, in
from websockets.protocol import WebSocketCommonProtocol
ModuleNotFoundError: No module named 'websockets.protocol'

Any advice or help to fix it will be greatly appreciated

@FlorianLudwig
Copy link
Contributor

@ivanrulik can you post your config?

@ivanrulik
Copy link
Author

@FlorianLudwig sure thing, I’m using Mac OS Big Sur with python 3.8.2. I made this post also because I tried to use the library in windows 10 and got the same issue. I’m not really sure if maybe having the code inside a OneDrive synced folder could be the reason of the issue.

@HerrMuellerluedenscheid

websocket released v0.9

@FlorianLudwig
Copy link
Contributor

FlorianLudwig commented May 14, 2021

@ivanrulik could you retry with the current master branch from amqtt?

@doanthienthuan
Copy link

i have the same error ? have anyone fixed it

@FlorianLudwig
Copy link
Contributor

I just released amqtt version 0.10.0-alpha.4 which is compatible with websocktets versions 9.x

@mweinelt
Copy link

https://websockets.readthedocs.io/en/stable/changelog.html#id5

The client, server, protocol, and auth modules were moved from the websockets package to websockets.legacy sub-package, as part of an upcoming refactoring. Despite the name, they’re still fully supported. The refactoring should be a transparent upgrade for most uses when it’s available. The legacy implementation will be preserved according to the backwards-compatibility policy.

mweinelt added a commit to mweinelt/hbmqtt that referenced this issue Jun 20, 2021
> The client, server, protocol, and auth modules were moved from the websockets package to websockets.legacy sub-package, as part of an upcoming refactoring. Despite the name, they’re still fully supported. The refactoring should be a transparent upgrade for most uses when it’s available. The legacy implementation will be preserved according to the backwards-compatibility policy.

https://websockets.readthedocs.io/en/stable/changelog.html#id5

Fixes: njouanin#239
@mweinelt mweinelt linked a pull request Jun 20, 2021 that will close this issue
@sina-rostami
Copy link

sina-rostami commented Aug 16, 2021

pip install "websockets==8.1"

worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants