How to check the version of Python Modules


If you are wondering how to check the version of the modules that you have with Python, you can pip/pip3 installer to do so.

Let's take a look at a few examples.


Using the "pip list" command:

% pip list | grep spacy

spacy                    3.5.2
spacy-legacy             3.0.12
spacy-loggers            1.0.4

As the pip list command will print out the list of all the installed module's versions, you can pip the command with grep followed by the specific module you are looking for.

pip list to check the version of a module using terminal
Example: Get the list of versions for all installed Python modules:
% pip list

Package                  Version
------------------------ ---------
anyio                    3.6.2
appnope                  0.1.3
argon2-cffi              21.3.0
argon2-cffi-bindings     21.2.0
arrow                    1.2.3
asttokens                2.2.1
attrs                    23.1.0
backcall                 0.2.0
beautifulsoup4           4.12.2
bleach                   6.0.0
blis                     0.7.9
catalogue                2.0.8
certifi                  2022.12.7
cffi                     1.15.1
charset-normalizer       3.1.0
click                    8.1.3
comm                     0.1.3
confection               0.0.4
contourpy                1.1.0
cycler                   0.11.0
cymem                    2.0.7
debugpy                  1.6.7
decorator                5.1.1
defusedxml               0.7.1
docutils                 0.20.1
EasyProcess              1.1
en-core-web-sm           3.5.0
entrypoint2              1.1
executing                1.2.0
fastjsonschema           2.16.3
fonttools                4.40.0
fqdn                     1.5.1
gensim                   4.3.1
idna                     3.4
ipykernel                6.22.0
ipython                  8.13.2
ipython-genutils         0.2.0
isoduration              20.11.0
jedi                     0.18.2
Jinja2                   3.1.2
jsonpointer              2.3
jsonschema               4.17.3
jupyter_client           8.2.0
jupyter_core             5.3.0
jupyter-events           0.6.3
jupyter_server           2.5.0
jupyter_server_terminals 0.4.4
jupyterlab-pygments      0.2.2
kiwisolver               1.4.4
langcodes                3.3.0
MarkupSafe               2.1.2
matplotlib               3.7.1
matplotlib-inline        0.1.6
mistune                  2.0.5
mss                      9.0.1
murmurhash               1.0.9
nbclassic                1.0.0
nbclient                 0.7.4
nbconvert                7.3.1
nbformat                 5.8.0
nest-asyncio             1.5.6
notebook                 6.5.4
notebook_shim            0.2.3
numpy                    1.24.2
packaging                23.1
pandocfilters            1.5.0
parso                    0.8.3
pathy                    0.10.1
pexpect                  4.8.0
pickleshare              0.7.5
Pillow                   10.0.0
pip                      23.1.2
platformdirs             3.5.0
preshed                  3.0.8
prometheus-client        0.16.0
prompt-toolkit           3.0.38
psutil                   5.9.5
ptyprocess               0.7.0
pure-eval                0.2.2
pycparser                2.21
pydantic                 1.10.7
Pygments                 2.15.1
pyparsing                3.1.0
pyrsistent               0.19.3
pyscreenshot             3.1
python-dateutil          2.8.2
python-json-logger       2.0.7
PyYAML                   6.0
pyzmq                    25.0.2
requests                 2.28.2
rfc3339-validator        0.1.4
rfc3986-validator        0.1.1
scipy                    1.11.1
Send2Trash               1.8.2
setuptools               67.6.1
six                      1.16.0
smart-open               6.3.0
sniffio                  1.3.0
soupsieve                2.4.1
spacy                    3.5.2
spacy-legacy             3.0.12
spacy-loggers            1.0.4
srsly                    2.4.6
stack-data               0.6.2
termcolor                2.2.0
terminado                0.17.1
thinc                    8.1.9
tinycss2                 1.2.1
tornado                  6.3.1
tqdm                     4.65.0
traitlets                5.9.0
typer                    0.7.0
typing_extensions        4.5.0
uri-template             1.2.0
urllib3                  1.26.15
wasabi                   1.1.1
wcwidth                  0.2.6
webcolors                1.13
webencodings             0.5.1
websocket-client         1.5.1
wheel                    0.40.0
wordcloud                1.9.2

Using pip show command

If you want to know more details of a module along with its version you can make use of the pip show command.

Example:
 % pip show numpy

Name: numpy
Version: 1.24.2
Summary: Fundamental package for array computing in Python
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD-3-Clause
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: 
Required-by: blis, contourpy, gensim, matplotlib, scipy, spacy, thinc, wordcloud

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap