diff --git a/impacket/version.py b/impacket/version.py
index 520d0a4..8889bdd 100644
--- a/impacket/version.py
+++ b/impacket/version.py
@@ -7,17 +7,11 @@
 # for more information.
 #
 
-import pkg_resources
+from importlib.metadata import version
 from impacket import __path__
 
 
-try:
-    version = pkg_resources.get_distribution('impacket').version
-except pkg_resources.DistributionNotFound:
-    version = "?"
-    print("Cannot determine Impacket version. "
-          "If running from source you should at least run \"python setup.py egg_info\"")
-BANNER = "Impacket v{} - Copyright 2023 Fortra\n".format(version)
+BANNER = "Impacket v{} - Copyright 2023 Fortra\n".format(version('impacket'))
 WARNING_BANNER = "".join(("===============================================================================\n",
                           "  Warning: This functionality will be deprecated in the next Impacket version  \n", 
                           "===============================================================================\n"))
