How To Install python-socketio on Ubuntu 18.04

In this tutorial we learn how to install python-socketio on Ubuntu 18.04. python-socketio is Socket.IO server based on the gevent pywsgi server

Introduction

In this tutorial we learn how to install python-socketio on Ubuntu 18.04.

What is python-socketio

python-socketio is:

gevent-socketio is a Python implementation of the Socket.IO protocol, developed originally for Node.js by LearnBoost and then ported to other languages. Socket.IO enables real-time web communications between a browser and a server, using a WebSocket-like API. One aim of this project is to provide a single gevent-based API that works across the different WSGI-based web frameworks out there (Pyramid, Pylons, Flask, web2py, Django, etc…). Only ~3 lines of code are required to tie-in gevent-socketio in your framework. Note: you need to use the gevent Python WSGI server to use gevent-socketio.

There are three methods to install python-socketio on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-socketio Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-socketio using apt-get by running the following command:

sudo apt-get -y install python-socketio

Install python-socketio Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-socketio using apt by running the following command:

sudo apt -y install python-socketio

Install python-socketio Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-socketio using aptitude by running the following command:

sudo aptitude -y install python-socketio

How To Uninstall python-socketio on Ubuntu 18.04

To uninstall only the python-socketio package we can use the following command:

sudo apt-get remove python-socketio

Uninstall python-socketio And Its Dependencies

To uninstall python-socketio and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-socketio

Remove python-socketio Configurations and Data

To remove python-socketio configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-socketio

Remove python-socketio configuration, data, and all of its dependencies

We can use the following command to remove python-socketio configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-socketio

References

Summary

In this tutorial we learn how to install python-socketio package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.