{"slug": "fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory", "title": "Fix \"ModuleNotFoundError: No module named 'agno.memory.v2'\" (Agno v1 v2+ memory migration)", "summary": "Mohammed, founder of MemorySync, documented the breaking changes in Agno v2+ that cause the \"ModuleNotFoundError: No module named 'agno.memory.v2'\" and companion 'agno.storage' import errors, reproduced on Agno 3.1.10 with Python 3.13. The migration replaces the removed v1 memory and storage modules with a unified `Db` class from `agno/db`, deprecates `MemoryDb` in favor of setting `update_memory_on_run=True` on an Agent with a `db`, and requires `user_id` on every run. He also noted a `greenlet` dependency for `agno.db.sqlite` and demonstrated routing memories to a hosted store via MemorySync's `MemorySyncDb` while keeping sessions local.", "body_md": "*Disclosure: I'm Mohammed, founder of MemorySync. I drafted this with AI assistance and checked it against Agno's official migration guide and a real install. Code status: on Oct 25, 2026 I installed agno 3.1.10 (Python 3.13) and reproduced the errors below. I then ran the \"after\" imports, the Agent construction and `get_user_memories` successfully. No model was called (no key), so memory creation itself was not run.*\n\nYou upgrade Agno and memory code that used to work fails on import:\n\n```\nModuleNotFoundError: No module named 'agno.memory.v2'\n```\n\nor, in VS Code / Pylance:\n\n```\nImport \"agno.memory.v2.memory\" could not be resolved\n```\n\noften with a companion:\n\n```\nModuleNotFoundError: No module named 'agno.storage'\n```\n\nThis was reported in [agno-agi/agno#5017](https://github.com/agno-agi/agno/issues/5017) (Agno 2.1.4, Python 3.11). The maintainers' answer was to follow the memory section of the v2 migration guide. I reproduced all three errors on Agno 3.1.10:\n\n``` python\n$ python -c \"from agno.memory.v2.memory import Memory\"\nModuleNotFoundError: No module named 'agno.memory.v2'\n$ python -c \"from agno.storage.sqlite import SqliteStorage\"\nModuleNotFoundError: No module named 'agno.storage'\n```\n\nAgno v2 removed the v1 memory and storage modules rather than aliasing them. Per the [v2 migration guide](https://docs.agno.com/other/v2-migration):\n\n`Storage` classes moved from `agno/storage` to `agno/db` and are now called `Db` classes. One instance serves agents, teams and workflows, and the `mode` and `table_name` parameters are gone.`MemoryDb` classes are deprecated in favour of the main `Memory` class is deprecated. You set `update_memory_on_run=True` on an Agent that has a `db`.\n**v1 (breaks):**\n\n``` python\nfrom agno.agent import Agent\nfrom agno.memory.v2.db.sqlite import SqliteMemoryDb\nfrom agno.memory.v2.memory import Memory\nfrom agno.storage.sqlite import SqliteStorage\n\nmemory = Memory(db=SqliteMemoryDb(table_name=\"user_memories\", db_file=\"agno.db\"))\nstorage = SqliteStorage(table_name=\"agent_sessions\", db_file=\"agno.db\")\nagent = Agent(memory=memory, storage=storage, enable_user_memories=True)\n```\n\n**v2+ (ran on 3.1.10):**\n\n``` python\nfrom agno.agent import Agent\nfrom agno.db.sqlite import SqliteDb\n\ndb = SqliteDb(db_file=\"agno.db\")          # sessions AND memories\nagent = Agent(db=db, update_memory_on_run=True)\n\nprint(agent.get_user_memories(user_id=\"john@example.com\"))  # [] until a run stores something\n```\n\nThings to check after the swap:\n\n`user_id` on every run.`SqliteDb` takes `session_table=` and `memory_table=` instead of `table_name=`.` MemoryManager` (`from agno.memory import MemoryManager`) and pass `memory_manager=` to the Agent. The parameter names I found on the current `Agent` are `memory_manager`, `enable_agentic_memory`, `update_memory_on_run` and `add_memories_to_context`.` TypeError: UserMemory.__init__() got an unexpected keyword argument 'summaries'`.\nIf you get `ImportError: The SQLAlchemy asyncio module requires that the Python 'greenlet' library is installed` when importing `agno.db.sqlite`, run `pip install greenlet`. I hit this on a clean Python 3.13 venv.\n\n`update_memory_on_run` writes to whatever `Db` you pass. If you want sessions to stay local but user memories to live in a hosted store shared across instances, MemorySync's `agno-memorysync` package backs Agno's `MemoryManager` ([guide](https://docs.memorysync.io/guides/agno?utm_source=devto&utm_medium=organic_page&utm_campaign=v5_oct25&utm_content=pseo_agno-memory-v2-module-not-found)). The guide says it needs agno 2.8+, and this constructed fine on 3.1.10:\n\n``` python\nfrom agno.agent import Agent\nfrom agno.db.sqlite import SqliteDb\nfrom agno.memory import MemoryManager\nfrom agno_memorysync import MemorySyncDb   # pip install agno-memorysync; needs MEMORYSYNC_API_KEY\n\nagent = Agent(\n    db=SqliteDb(db_file=\"agent.db\"),                  # sessions: local\n    memory_manager=MemoryManager(db=MemorySyncDb()),  # memories: hosted\n    update_memory_on_run=True,\n    user_id=\"customer-42\",\n)\n```\n\nThe guide notes that `MemorySyncDb` is memory-only on purpose. Pointing sessions at it raises `MemorySyncMemoryOnlyError`, so keep `db=` local.\n\n**Is there a compatibility shim for `agno.memory.v2`?** Not in 3.1.10. The import fails. Update the imports.\n\n**Do I still need a separate storage object?** No. One `Db` instance handles sessions, memories, metrics, evals and knowledge in separate tables.\n\n**My memories are stored but never show up in replies.** If you pass a verbatim `system_message=`, it replaces Agno's built system prompt, which is where memories are injected. Use `instructions=` instead. (This tip is from MemorySync's Agno guide and applies to any memory db.)\n\n**Which Agno version is current?** PyPI served 3.1.10 on Oct 25, 2026. The v2 migration steps above still applied to it.\n\nTo see a stored fact survive a reload before wiring anything in: **[try MemorySync in your browser](https://memorysync.io/try?utm_source=devto&utm_medium=organic_page&utm_campaign=v5_oct25&utm_content=pseo_agno-memory-v2-module-not-found)**. No signup is needed.\n\n`summaries` TypeError):", "url": "https://wpnews.pro/news/fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory", "canonical_source": "https://dev.to/memorysync_rafay/fix-modulenotfounderror-no-module-named-agnomemoryv2-agno-v1-v2-memory-migration-onl", "published_at": "2026-10-25 16:40:14+00:00", "updated_at": "2026-10-25 16:44:44.701475+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-products"], "entities": ["Agno", "MemorySync", "Mohammed", "agno-memorysync", "SqliteDb", "MemoryManager", "Python"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory", "markdown": "https://wpnews.pro/news/fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory.md", "text": "https://wpnews.pro/news/fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory.txt", "jsonld": "https://wpnews.pro/news/fix-modulenotfounderror-no-module-named-agno-memory-v2-agno-v1-v2-memory.jsonld"}}