Replace package.__version__ in scripts with: >>> from importlib.metadata import version >>> version(' package') This works even if there is no __version__ attribute and is more informative.