Your message dated Sun, 08 Nov 2026 17:34:41 +0000
with message-id <[email protected]>
and subject line Bug#1153238: fixed in python-shodan 1.31.0-3
has caused the Debian Bug report #1153238,
regarding python3-shodan: shodan fails to start: ModuleNotFoundError: No module 
named 'pkg_resources'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1153238: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1153238
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-shodan
Version: 1.31.0-2
Severity: critical
Tags: patch

Dear maintainer,

the `shodan` command fails at startup, regardless of arguments:

```
$ shodan
Traceback (most recent call last):
  File "/usr/bin/shodan", line 33, in <module>
sys.exit(load_entry_point('shodan==1.31.0', 'console_scripts', 'shodan')()) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/shodan", line 25, in importlib_load_entry_point
    return next(matches).load()
           ~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/importlib/metadata/__init__.py", line 179, in load
    module = import_module(match.group('module'))
File "/usr/lib/python3.14/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1406, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 763, in exec_module
File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed File "/usr/lib/python3/dist-packages/shodan/__main__.py", line 33, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
```

Expected behaviour:
`shodan` prints its usage; `shodan version` prints 1.31.0.


Cause:
shodan/__main__.py imports pkg_resources for plugin discovery and for get_distribution().version`. src:setuptools >= 81 no longer builds python3-pkg-resources (python3-setuptools 84.2.0-1 is in testing/ unstable breaking python3-pkg-resources which has been removed from testing). python3-shodan also does not declare dependency on python3-pkg-resources or python3-setuptools, so it only worked when either package happened to be installed.


Suggested fixes

Upstream:
The issue is reported upstream and has open pull requests
(https://github.com/achillean/shodan-python/pull/248,
https://github.com/achillean/shodan-python/pull/253). The last upstream
commit is from December 2023, so a downstream patch seems necessary for now.

Proposed Patch:
The attached patch (to be applied after pr241-click-plugins.patch) replaces pkg_resources with importlib.metadata. Plugin discovery passes the group name to the vendored with_plugins(), which already resolves it
via importlib.metadata.entry_points().


Reproduced on Kali rolling, which ships this package unmodified from Debian SID.

Kernel version:
Linux 0trust 7.1.5+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 7.1.5-1kali1 (2026-07-29) x86_64 GNU/Linux


Shared C library:
-rwxr-xr-x 1 root root 2317000 Oct  3 15:48 /lib/i386-linux-gnu/libc.so.6
-rwxr-xr-x 1 root root 2014248 Oct  3 15:48 /lib/x86_64-linux-gnu/libc.so.6



Description: Replace pkg_resources with importlib.metadata
 pkg_resources was removed from setuptools (>= 81), which causes the shodan
 CLI to fail with "ModuleNotFoundError: No module named 'pkg_resources'".
 Instead use importlib.metadata for the version lookup and pass the
 entry point group name to with_plugins(), which already resolves it via
 importlib.metadata.entry_points().
Author: Thomas Zink <[email protected]>

--- a/shodan/__main__.py
+++ b/shodan/__main__.py
@@ -30,7 +30,6 @@
 import csv
 import os
 import os.path
-import pkg_resources
 import shodan
 import shodan.helpers as helpers
 import threading
@@ -48,9 +47,6 @@
 from shodan.cli.helpers import async_spinner, get_api_key, escape_data, timestr, open_streaming_file, get_banner_field, match_filters
 from shodan.cli.host import HOST_PRINT
 
-# Allow 3rd-parties to develop custom commands
-from pkg_resources import iter_entry_points
-
 # Large subcommands are stored in separate modules
 from shodan.cli.alert import alert
 from shodan.cli.data import data
@@ -58,6 +54,7 @@
 from shodan.cli.scan import scan
 from shodan.click_plugins import with_plugins
 
+from importlib.metadata import version as distribution_version
 
 # Make "-h" work like "--help"
 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@@ -78,7 +75,7 @@
 
 # Define the main entry point for all of our commands
 # and expose a way for 3rd-party plugins to tie into the Shodan CLI.
-@with_plugins(iter_entry_points('shodan.cli.plugins'))
+@with_plugins('shodan.cli.plugins')
 @click.group(context_settings=CONTEXT_SETTINGS)
 def main():
     pass
@@ -942,8 +939,7 @@
 @main.command()
 def version():
     """Print version of this tool."""
-    print(pkg_resources.get_distribution("shodan").version)
-
+    print(distribution_version("shodan"))
 
 if __name__ == '__main__':
     main()

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


--- End Message ---
--- Begin Message ---
Source: python-shodan
Source-Version: 1.31.0-3
Done: Alexandre Detiste <[email protected]>

We believe that the bug you reported is fixed in the latest version of
python-shodan, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Alexandre Detiste <[email protected]> (supplier of updated python-shodan package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 08 Nov 2026 18:19:51 +0100
Source: python-shodan
Architecture: source
Version: 1.31.0-3
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <[email protected]>
Changed-By: Alexandre Detiste <[email protected]>
Closes: 1153238
Changes:
 python-shodan (1.31.0-3) unstable; urgency=medium
 .
   * Team Upload
   * Update standards version to 4.7.4 & remove Priority: tag
   * Set upstream metadata fields: Repository.
   * Add debian/salsa-ci.yml
   * Rewrite d/watch in v5 format
   * Define nodoc profile
 .
   [ Thomas Zink ]
   * patch-out usage of pkg_resources (Closes: #1153238)
Checksums-Sha1:
 61428e0ce71124590780738f5d4a5795a7067e1e 2242 python-shodan_1.31.0-3.dsc
 96ddef316e22c751b59df15db46052129d6366e3 8600 
python-shodan_1.31.0-3.debian.tar.xz
 dc16e9134d14c38d9e59bb23624a66de67a384c7 7602 
python-shodan_1.31.0-3_source.buildinfo
Checksums-Sha256:
 8bde3759de3738351fac248e4124b0c9cb6a87ee60d7f81e774cb5d2b303056c 2242 
python-shodan_1.31.0-3.dsc
 482906a791fa093bed722f7f2f379ea1ebba81e011a38109f8a44c8e78112b70 8600 
python-shodan_1.31.0-3.debian.tar.xz
 7537c62e4d6401c499baa1ccf94cbf0817a61ea87d288d1210bd4143ef6bbf0f 7602 
python-shodan_1.31.0-3_source.buildinfo
Files:
 d4537adfd5f96345799d09f6871bb1aa 2242 python optional 
python-shodan_1.31.0-3.dsc
 bd0c1bb25e331ff686227abfcf78ca6f 8600 python optional 
python-shodan_1.31.0-3.debian.tar.xz
 ffc28f214eb8f1b9888640789311b443 7602 python optional 
python-shodan_1.31.0-3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEEj23hBDd/OxHnQXSHMfMURUShdBoFAmrwr4MRHHRjaGV0QGRl
Ymlhbi5vcmcACgkQMfMURUShdBpZqQ/9FXnoFCAnbENhT+qI3kaA26VjJv4V5rVk
yow3UlY5AJtGNz6GGd9lphoOD4dA4ptStfb7vX/nL4B1ko+0XxU3O3Z3b50rjXOT
4Kps5mF7nrhIwgjylwVgeTw++NFH6mEXI8VpFZND6aaFIizeV1t1m+gHxpM9Cyxe
qsc0baiOLTW9Yl5BL1MFBNF4HvdCFL3hWIOpZAIYmqQOeUHlOO6v4rP84QCnkQBk
0Lw6pjb4TyxMnlPFIaTGJrNWEgLenz3DFelZHfNkXEPx5ct4DFe7iYV4pWXG9xQ9
zEMj7nON/JwnWWTE4+U4rS35SovcXMAztlu6Q3JELqNOYRuq5NJzwqWAN0abdbnz
zB2jFVj00HSCYiWGr18zfIPBYHkxxWvQvElzIZ4CPUK4HW+btb7nsaseVFKuw9Ce
+JSXhjONGJkPNisgMl3c6g2pVGD1GoUrYR+8xBifHpG+b6+AB77lFwka+EyKvez8
gxETnmCg6PBC3zoDz/VnzEVYASMYRXP+gmfky0osnHvEZ2iKH+7bqKndd6/86Ozs
cTtFfbmC8cSDUSz+dwEsYnc1nDs11i0yjfh14BV0owRYYyddMa+nVnhbbtr6mTFA
NUiLgg3QmjmOh8Om4M5bcZmiVZ6rGUZUkdVfItSvLy6hBZIWGptynpqpQMAAXZxG
nm88QJ8SFUM=
=U+I9
-----END PGP SIGNATURE-----

Attachment: pgpib0SL0Cir_.pgp
Description: PGP signature


--- End Message ---

Reply via email to