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