diff --git a/setup.py b/setup.py
index 84fc04372952b6cb7dca1d64eed0281f10e78b43..750c8132418a9ea578c7c6fe954788748c5d2c2b 100644
--- a/setup.py
+++ b/setup.py
@@ -20,9 +20,13 @@ from setuptools import find_packages, setup
 
 def write_version():
     import subprocess
-    p = subprocess.Popen(["git", "describe", "--dirty", "--tags", "--always"],
-                         stdout=subprocess.PIPE)
-    res = p.communicate()[0].strip().decode('utf-8')
+    try:
+        p = subprocess.Popen(["git", "describe", "--dirty", "--tags", "--always"],
+                             stdout=subprocess.PIPE)
+        res = p.communicate()[0].strip().decode('utf-8')
+    except FileNotFoundError:
+        print("Could not determine version string from git history")
+        res = "unknown"
     with open("nifty7/git_version.py", "w") as file:
         file.write('gitversion = "{}"\n'.format(res))