diff --git a/setup.py b/setup.py
index 2a9a986..e8995bc 100644
--- a/setup.py
+++ b/setup.py
@@ -4,3 +4,3 @@ from setuptools import setup, find_packages
 import subprocess
-import imp
+from importlib.machinery import SourceFileLoader
 
@@ -92,3 +92,3 @@ if not release:
         # must be a source distribution, use existing version file
-        version = imp.load_source('nimfa.version', 'nimfa/version.py')
+        version = SourceFileLoader('nimfa.version', 'nimfa/version.py').load_module()
         GIT_REVISION = version.git_revision
