One usually gets the pandas version in Python as follows:
import pandas
print(pandas.__version__)
However if numpy version 2.0.0 or higher is installed, and the pandas version is < 2.2.2 it typically crashes as follows on the import statement:
Is there a clever way to check the pandas version (within Python) in order to warn the user of this incompatibility instead of the user-unfriendly traceback dump?

try: ... except ValueError: ...to catch the error pandas is throwing.