Circuits compatibility issue with setuptools.

1 view
Skip to first unread message

Pratik Patil

unread,
Oct 5, 2026, 7:03:39 PM (4 days ago) Oct 5
to circuits

Hi circuits team,

I wanted to report a compatibility issue in circuits (tested on 3.2.3 and 3.2.4) when running alongside setuptools >= 67, and share a one-line fix.

Background

Our project ships setuptools 84.0.0 as a pinned dependency due to security vulnerabilities in earlier versions of setuptools. After upgrading, our application began crashing at import time with:

File "circuits/init.py", line 42, in import('pkg_resources').declare_namespace(name) AttributeError: module 'pkg_resources' has no attribute 'declare_namespace'

Root cause

pkg_resources.declare_namespace was removed in setuptools >= 67 as part of the migration to importlib.metadata. The current exception handler in circuits/init.py only catches ImportError, which handles the case where pkg_resources itself is absent — but not the case where it is present but missing the declare_namespace attribute:

try: import('pkg_resources').declare_namespace(name) except ImportError: ...

Proposed fix

Catching AttributeError alongside ImportError allows the existing importlib.metadata fallback path to run correctly:

try: import('pkg_resources').declare_namespace(name) except (ImportError, AttributeError): ...

This is a one-line change and is backwards compatible with all older versions of setuptools.

We have been running with this patch in production and it resolves the issue completely. Happy to open a PR if that would be helpful.

Thanks for maintaining circuits!

Best regards, Pratik Patil IBM SOAR Integration

Reply all
Reply to author
Forward
0 new messages