diff --git a/envsetup.py b/envsetup.py
index 77048ac53bc7a144f62568d3655e8f2754a0777f..f66e4a91f34bf24deef9e29172ad459a6463914c 100755
--- a/envsetup.py
+++ b/envsetup.py
@@ -3,7 +3,7 @@
 '''
 Environment setup script for MediaServer
 '''
-import imp
+import importlib.util
 import os
 import subprocess
 import sys
@@ -97,7 +97,9 @@ class EnvSetup():
                     continue
 
                 if os.path.isfile(os.path.join(path, self.PY_SETUP_NAME)):
-                    setup_module = imp.load_source('setup_%s' % name, os.path.join(path, self.PY_SETUP_NAME))
+                    spec = importlib.util.spec_from_file_location('setup_%s' % name, os.path.join(path, self.PY_SETUP_NAME))
+                    setup_module = importlib.util.module_from_spec(spec)
+                    spec.loader.exec_module(setup_module)
                     actions.append(dict(index=index, label=label, path=path, fct=setup_module.setup))
                 elif os.path.isfile(os.path.join(path, self.BASH_SETUP_NAME)):
                     actions.append(dict(index=index, label=label, path=path, fct='bash -e "%s"' % os.path.join(path, self.BASH_SETUP_NAME)))