No module named 'websocket' - python

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.

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.

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"

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.

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

Try with pip install websockets that's work for me!

If you are using pip, as mentioned it is pip install websockets
However, if you are using conda,
use: conda install -c conda-forge websockets

Related

im new and python wont let me install the pafy module or the vlc module so i can do my first project, how to fix?

Hi I'm new and am trying to see how Python Modules work but whenever I do import pafy it says modulenotfounderror and when I do install pafy it says that the I in install is a syntax error.
so how do I fix this? do I download something? and I know the answer might seem obvious but this is my first time using one and those two are the only answers im getting, so help a brother out?
You need to use the command line to pip install pafy
For more information see the pip documentation.
Alternatively, if you want to install it from a python file, you can make one and run it with this code:
import pip
pip.main(['install', 'pafy'])
Use pip from command line.
Assuming you've installed python from the official website (https://python.org), pip should be pre-installed, and you can simply run command line (hotkey win + r and type in cmd on windows) and type in pip install <module name here>, which in your case would be pafy.
Use (this website) for more info, it provides pip commands for macOS, Windows and Linux

Python imports aren't installing / can't be found

Firstly, I'm super new to Python/code and stackoverflow, so apologies if I sound like a child trying to explain complex rocket science.
I'm following a tutorial on creating a fake teachers database, and they say
import mysql.connector
from mysql.connector import Error
import panda
however, when I go to import, I get an error of
ImportError: Unable to import required dependencies:
pytz: No module named 'pytz'
dateutil: No module named 'dateutil'
Despite the modules being imported and in the Python folder. It took me around 30 minutes to get MySQL imported, and honestly I'm not even really sure how it fixed. I renamed the folder, I copied the folder into the virtual environment I'm using (which I'm not even sure how to not use that, it seems to just create difficulties in doing any importing), I had to reinstall pip multiple times as it also error'd the first 2 tries. I'm really confused and a little frustrated as I have zero idea how to fix this, or what even the errors are in the first place.
Any help would be much appreciated!!
Pip should be included with your Python installation. Try pip install mysql and pip install panda. If that doesn't work try py -m pip install mysql and py -m pip install panda.
Try:
pip3 install mysql pytz
You can install multiple packages at the same time!
If you want to get out of the virtual environment you created you can use the deactivate command.
See If pip is installed in your system
If its Installed , Install pytz by exeuting
pip install pytz
Install Pip = https://bootstrap.pypa.io/get-pip.py
Just download and run this file

PyCharm does not import Scapy module

I am trying and failing to import scapy into python, which I have now been playing with for hours and all the google hits I get seem to make sense but when I try them - it fails.
first off I am using python3 and have that nicely in pycharm:
Correct Interpreter
I have also installed the package using pip3:
pip3 install scapy-python3
this appears in PyCharm as you can see in the picture. So I am now on a par with the other guides I found.
So finally I try:
from scapy import *
and for good measure
from scapy.all import *
which is for Python2 and 3k from what I read.
Could someone give me a hand, I don't know where to go next.
Gareth
Scapy-python3 is a different and outdated project.
The correct way to install scapy on python 3 is
pip3 install scapy
Or
python3 -m pip install scapy
In some cases it is better to install scapy package for python2, too; by following command:
pip install scapy
try this.

Install Skype4Py module on windows

When i try to install the Skype4Py and run setup.py in my cmd this message comes up:
I have python 2.x. Any ideas where I am making a mistake. Thanks in advance!
just run : python setup.py install
It seems like an easier way to install Skype4Py would be to use Pip, which you can download from https://pip.pypa.io/en/latest/installing/ but if you are using 2.7.9+ or 3.4+ it comes preinstalled. Next you will want to run the command "pip install Skype4Py" to install the package. Once this is all installed, use the Quick-Start documentation, found here https://github.com/Skype4Py/Skype4Py#usage to help you get started. Good Luck!

ImportError: No module named pythoncom

I am a newbie (just 1 week) to this Python world. I tried installing django-mssql, but when I tried to import the library (using import sqlserver_ado.dbapi), I got this error message:
ImportError: No module named pythoncom
I tried to look for that library without success.
Can you guys point me in the right direction?
You are missing the pythoncom package. It comes with ActivePython but you can get it separately on GitHub (previously on SourceForge) as part of pywin32.
You can also simply use:
pip install pywin32
If you're on windows you probably want the pywin32 library, which includes pythoncom and a whole lot of other stuff that is pretty standard.
You should be using pip to install packages, since it gives you uninstall capabilities.
Also, look into virtualenv. It works well with pip and gives you a sandbox so you can explore new stuff without accidentally hosing your system-wide install.
$ pip3 install pypiwin32
Sometimes using pip3 also works if just pip by itself is not working.
Just go to cmd and install pip install pywin32 pythoncom is part of pywin32 for API window extension....

Categories

Resources