diff --git a/bilby/__init__.py b/bilby/__init__.py
index df7998a26647b685848de6d50c9a5775f36683e2..e6c17560e57d64f638372d8f68851601c5757fd7 100644
--- a/bilby/__init__.py
+++ b/bilby/__init__.py
@@ -23,3 +23,5 @@ from . import core, gw, hyper
 from .core import utils, likelihood, prior, result, sampler
 from .core.sampler import run_sampler
 from .core.likelihood import Likelihood
+
+__version__ = '0.3.1'
diff --git a/docs/conf.py b/docs/conf.py
index 26826cd01e885f00864b28b0b9a3838c7c48a557..e15e6497694889872f7ebda81705727491e5e0df 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,6 +18,7 @@
 #
 import os
 import sys
+import bilby
 sys.path.insert(0, os.path.abspath('../bilby/'))
 
 
@@ -55,9 +56,9 @@ author = u'Paul Lasky'
 # built documents.
 #
 # The short X.Y version.
-version = u'0.2'
+version = bilby.__version__
 # The full version, including alpha/beta/rc tags.
-release = u'0.2'
+release = bilby.__version__
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/setup.py b/setup.py
index 1fb510d196306d87f49e47ef8d9632cbcd1f0fca..e8c23c6eb38d2af18176286dc5fabcb38e296d37 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,8 @@
 
 from setuptools import setup
 import subprocess
-from os import path
+import re
+import os
 
 
 def write_version_file(version):
@@ -35,7 +36,7 @@ def write_version_file(version):
         git_status = ''
 
     version_file = '.version'
-    if path.isfile(version_file) is False:
+    if os.path.isfile(version_file) is False:
         with open('bilby/' + version_file, 'w+') as f:
             f.write('{}: {}'.format(version, git_status))
 
@@ -44,14 +45,27 @@ def write_version_file(version):
 
 def get_long_description():
     """ Finds the README and reads in the description """
-    here = path.abspath(path.dirname(__file__))
-    with open(path.join(here, 'README.rst')) as f:
+    here = os.path.abspath(os.path.dirname(__file__))
+    with open(os.path.join(here, 'README.rst')) as f:
             long_description = f.read()
     return long_description
 
 
-version = '0.3.1'
-version_file = write_version_file(version)
+# get version info from __init__.py
+def readfile(filename):
+    with open(filename) as fp:
+        filecontents = fp.read()
+    return filecontents
+
+
+VERSION_REGEX = re.compile(r"__version__ = \'(.*?)\'")
+CONTENTS = readfile(os.path.join(
+    os.path.dirname(os.path.abspath(__file__)),
+    "bilby", "__init__.py"))
+VERSION = VERSION_REGEX.findall(CONTENTS)[0]
+
+
+version_file = write_version_file(VERSION)
 long_description = get_long_description()
 
 setup(name='bilby',
@@ -61,7 +75,7 @@ setup(name='bilby',
       author='Greg Ashton, Moritz Huebner, Paul Lasky, Colm Talbot',
       author_email='paul.lasky@monash.edu',
       license="MIT",
-      version=version,
+      version=VERSION,
       packages=['bilby', 'bilby.core', 'bilby.core.sampler',
                 'bilby.gw', 'bilby.hyper', 'cli_bilby'],
       package_dir={'bilby': 'bilby'},