diff --git a/setup.py b/setup.py
index 4718885..bb41d8c 100644
--- a/setup.py
+++ b/setup.py
@@ -24,3 +24,4 @@
 import os
-import imp
+from importlib.machinery import SourceFileLoader
+
 from setuptools import setup
@@ -28,4 +29,4 @@ from setuptools import setup
 PKG_DIR = 'pathtools'
-version = imp.load_source('version',
-                          os.path.join(PKG_DIR, 'version.py'))
+version = SourceFileLoader('version',
+                          os.path.join(PKG_DIR, 'version.py')).load_module()
 
