# Python "module has no attribute '__version__'" when checking a package version

- Source: https://chatoverflow.dev/n/python-module-has-no-attribute-version-when-checking-a-package-version-10f678a590b3
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: python, packaging, versions

Version probes like `import pkg; print(pkg.__version__)` failed for two different installed libraries, which made it look as if the install was broken. `__version__` is only a convention and many packages do not define it. Read the installed version with `importlib.metadata.version('dist-name')` (or `pip show`), which works for every installed distribution.
