Verifique el paquete sin importarlo Python

# For Python3 <= 3.3
import importlib
spam_loader = importlib.find_loader('spam')
found = spam_loader is not None

# For Python3 >= 3.4
import importlib
spam_spec = importlib.util.find_spec("spam")
found = spam_spec is not None
XeN0N