How To Install python3-frozenlist on Ubuntu 22.04

In this tutorial we learn how to install python3-frozenlist on Ubuntu 22.04. python3-frozenlist is list-like structure which implements collections.abc.MutableSequence

Introduction

In this tutorial we learn how to install python3-frozenlist on Ubuntu 22.04.

What is python3-frozenlist

python3-frozenlist is:

frozenlist.FrozenList is a list-like structure which implements collections.abc.MutableSequence. The list is mutable until FrozenList.freeze is called, after which list modifications raise RuntimeError:

from frozenlist import FrozenList fl = FrozenList([17, 42]) fl.append(‘spam’) fl.append(‘Vikings’) fl <FrozenList(frozen=False, [17, 42, ‘spam’, ‘Vikings’])> fl.freeze() fl <FrozenList(frozen=True, [17, 42, ‘spam’, ‘Vikings’])> fl.frozen True fl.append(“Monty”) Traceback (most recent call last): File “”, line 1, in File “frozenlist/_frozenlist.pyx”, line 97, in frozenlist._frozenlist.FrozenList.append self._check_frozen() File “frozenlist/_frozenlist.pyx”, line 19, in frozenlist._frozenlist.FrozenList._check_frozen raise RuntimeError(“Cannot modify frozen list.”) RuntimeError: Cannot modify frozen list.

FrozenList is also hashable, but only when frozen. Otherwise it also throws a RuntimeError:

fl = FrozenList([17, 42, ‘spam’]) hash(fl) Traceback (most recent call last): File “”, line 1, in File “frozenlist/_frozenlist.pyx”, line 111, in frozenlist._frozenlist.FrozenList.hash raise RuntimeError(“Cannot hash unfrozen list.”) RuntimeError: Cannot hash unfrozen list. fl.freeze() hash(fl) 3713081631934410656 dictionary = {fl: ‘Vikings’} # frozen fl can be a dict key dictionary {<FrozenList(frozen=True, [1, 2])>: ‘Vikings’}

There are three methods to install python3-frozenlist on Ubuntu 22.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 python3-frozenlist Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python3-frozenlist

Install python3-frozenlist Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python3-frozenlist

Install python3-frozenlist 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 python3-frozenlist using aptitude by running the following command:

sudo aptitude -y install python3-frozenlist

How To Uninstall python3-frozenlist on Ubuntu 22.04

To uninstall only the python3-frozenlist package we can use the following command:

sudo apt-get remove python3-frozenlist

Uninstall python3-frozenlist And Its Dependencies

To uninstall python3-frozenlist and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove python3-frozenlist

Remove python3-frozenlist Configurations and Data

To remove python3-frozenlist configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge python3-frozenlist

Remove python3-frozenlist configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python3-frozenlist

References

Summary

In this tutorial we learn how to install python3-frozenlist package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.