diff --git a/MANIFEST.in b/MANIFEST.in
index ff301d6837b1c0023b2a89ffb9839eac0a4e9db3..f32d4f3d17079502cccd556699d845504908e52a 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
 include README.md
 include COPYING.txt
+include RELEASE-VERSION
diff --git a/setup.py b/setup.py
index 313f8f77f1bbed052baa92b9f432ce61a561f185..be7f9bfa5af9f75636578dac3acc6285d46babea 100644
--- a/setup.py
+++ b/setup.py
@@ -6,8 +6,6 @@ import distutils
 from distutils.extension import Extension
 from contextlib import redirect_stdout
 from importlib import import_module
-sys.path.insert(0, os.path.abspath('doc'))
-from version_from_git import version_number_from_git
 
 if '--use-cython' in sys.argv:
     USE_CYTHON = True
@@ -68,9 +66,19 @@ def cython_extensions(*extensions):
     return result
 
 
+try:
+    sys.path.insert(0, os.path.abspath('doc'))
+    from version_from_git import version_number_from_git
+    version=version_number_from_git()
+    with open("RELEASE-VERSION", "w") as f:
+        f.write(version)
+except ImportError:
+    version = open('RELEASE-VERSION', 'r').read()
+
+
 setup(name='pystencils',
-      version=version_number_from_git(),
       description='Speeding up stencil computations on CPUs and GPUs',
+      version=version,
       long_description=readme(),
       long_description_content_type="text/markdown",
       author='Martin Bauer',
@@ -107,5 +115,5 @@ setup(name='pystencils',
       python_requires=">=3.6",
       cmdclass={
           'quicktest': SimpleTestRunner
-      }
+      },
       )