Some are preinstalled in Colab and some installed with !pip install module_name
in Colab cell.
First you have to import the module, then run this command:
name_of_module.__version__
For example:
import nltk
import tensorflow as tf
nltk.__version__
# '3.2.5'
tf.__version__
# '2.6.0'