Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

No module named 'websocket'

Writer Matthew Barrera

I'm a fairly new to Python and I am trying to enter the following code:

from websocket import create_connection as cc
import json, time

I want to look at BTC and LTC stocks in a live feed type-fashion but I keep getting this error:

ModuleNotFoundError: No module named 'websocket'

I've been looking around and it seems that a common solution is:

pip install websocket

that just didn't connect with me. Most sites say install this and just have the above code but I have no idea where to install it or what to do with it.

1

6 Answers

First, you need to install pip if you don't have it. Type pip in your terminal or cmd to see if it is installed. Or else, install it first by downloading get-pip.py and executing it.

Then you do pip install websocket, which will install the module for you.

2

If the websocket and websocket-client doesn't work, try:

pip install websocket_client

It works for me.

Worked on my machine using

pip install "websockets==8.1"
1

you can also try

pip install websocket-client

There seem to be 2 packages in python 3.7: websocket, and websockets. In my case, I tried to install the former but it had to be the latter. Wasted half an hour of my life on that. People who get here might be in the same bag.

1

For me, nothing worked except Pycharm editor showed a suggestion 'install websocket' which worked(in the import line).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy