microsoft/semantic-kernel · error · AttributeError

module {__name__} has no attribute {name}

Error message

module {__name__} has no attribute {name}

What it means

Raised by the module-level `__getattr__` in `semantic_kernel/connectors/memory.py`, which implements lazy/deferred imports of memory connector classes via the `_IMPORTS` mapping. The requested attribute name is not present in `_IMPORTS`, so the module has no such attribute and Python surfaces a standard `AttributeError`. This is the canonical 'name not found' for the memory connector facade.

Source

Thrown at python/semantic_kernel/connectors/memory.py:53

    "QdrantStore": ".qdrant",
    "WeaviateCollection": ".weaviate",
    "WeaviateSettings": ".weaviate",
    "WeaviateStore": ".weaviate",
    "PineconeCollection": ".pinecone",
    "PineconeSettings": ".pinecone",
    "PineconeStore": ".pinecone",
    "SqlServerCollection": ".sql_server",
    "SqlServerStore": ".sql_server",
    "SqlSettings": ".sql_server",
}


def __getattr__(name: str):
    if name in _IMPORTS:
        submod_name = _IMPORTS[name]
        module = importlib.import_module(submod_name, package=__name__)
        return getattr(module, name)
    raise AttributeError(f"module {__name__} has no attribute {name}")


def __dir__():
    return list(_IMPORTS.keys())

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Check the `_IMPORTS` dict in memory.py for the exact registered class name and fix the typo / use the current name.
  2. If upgrading, consult the changelog/migration guide for renamed or removed memory connector classes.
  3. For the legacy memory-store classes (under `connectors.memory_stores`), import them from their specific subpackage instead of the `memory` facade.
  4. If the class should exist, verify you are on a Semantic Kernel version that ships it.

Example fix

// before
from semantic_kernel.connectors.memory import PineconCollection  # typo

// after
from semantic_kernel.connectors.memory import PineconeCollection
Defensive patterns

Strategy: validation

Validate before calling

from semantic_kernel.connectors import memory as _mem

_VALID = set(_mem._IMPORTS.keys())  # the lazily-exported names

def resolve(name: str):
    if name not in _VALID:
        raise AttributeError(
        f"{name!r} is not exported by connectors.memory. Valid: {sorted(_VALID)}"
    )
    return getattr(_mem, name)

Type guard

def is_known_memory_export(name: str) -> bool:
    from semantic_kernel.connectors.memory import _IMPORTS
    return name in _IMPORTS

Try / catch

try:
    from semantic_kernel.connectors.memory import PineconeCollection
except AttributeError as e:
    raise ImportError(
        "PineconeCollection not found; check spelling / SK version"
    ) from e

Prevention

When it happens

Trigger: Code does `from semantic_kernel.connectors import memory; memory.SomeClass` (or `from semantic_kernel.connectors.memory import SomeClass`) where `SomeClass` is misspelled, was renamed, was removed in a version upgrade, or is a class that never lived under this facade (e.g. legacy memory-store classes vs. the newer vector-store classes).

Common situations: Upgrading Semantic Kernel across major versions where connector class names changed (e.g. old `MemoryStore`-style names vs. the new `*Collection`/`*Store` vector-store names); typos like `PineconeColletion`; importing a class that lives in a subpackage not re-exported here; attempting to import an optional connector whose package isn't installed (the import inside `__getattr__` would then fail with ImportError, not this, so this specifically means the name isn't registered at all).

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/293c34e14cff2eb2. Report an issue: GitHub.