I installed python-socketio by this command :
sudo apt-get install python-socketio
But when I want to import it in my program, it has some error :
>>> from socketio import SocketIO
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from socketio import SocketIO
ImportError: No module named 'socketio'
What is the problem and how can I solve it ?
Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. It consists of: a Node. js server: Source | API. a Javascript client library for the browser (which can be also run from Node.
While not comparable to eventlet and gevent in terms of performance, the Socket.IO server can also be configured to work with multi-threaded web servers that use standard Python threads. This is an ideal setup to use with development servers such as Werkzeug.
Django socketio is a Django project that brings together a variety of features that allow you to use WebSockets seamlessly with any Django project. It is built on top of gevent-socketio which is a Python implementation of SocketIO protocol.
You can check the socket.io version in node_modules->socket.io->package. json and there will be "version": "your version of socket.io".
If you want to install socketio you have to use pip.
I like to use python 3 so I use this command in Ubuntu.
sudo -H pip3 install python-socketio
If you want to use default python which is probably set as to python2 use.
sudo -H pip install python-socketio
Also if you type pip and then hit tab twice in a row it will show all the different version you have available. For example my output looks like this.
pip pip2 pip2.7 pip3 pip3.5 pip-review
The following code can be used ::
sudo apt update
sudo apt install python-socketio
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With