diff --git a/__init__.py b/__init__.py
index 07a5c05ccee49b7769c0c95f3a879b4a8aee3293..dce829a43f9583670388748def3d2ec9c89efeba 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1 +1,2 @@
 '''Python MAVLink library - see https://mavlink.io/en/'''
+__version__ = '2.4.25'
diff --git a/setup.py b/setup.py
index 7b1325f411b916e31f636edda12e7b91c4439520..df5e3b324b9c694488a8c77270e16c2c298115a5 100644
--- a/setup.py
+++ b/setup.py
@@ -13,8 +13,8 @@ except LookupError:
 from setuptools import setup, Extension
 import glob, os, shutil, fnmatch, platform, sys
 
-version = '2.4.25'
-
+sys.path.insert(0, os.path.dirname(__file__))
+from __init__ import __version__
 
 def generate_content():
     # generate the file content...
@@ -107,7 +107,7 @@ class custom_build_py(build_py):
 
 
 setup (name = 'pymavlink',
-       version = version,
+       version = __version__,
        description = 'Python MAVLink code',
        long_description = ('A Python library for handling MAVLink protocol streams and log files. This allows for the '
                            'creation of simple scripts to analyse telemetry logs from autopilots such as ArduPilot which use '