Skip to content

[Bug] 创建消息收集器失败: No module named 'cachetools' #71

@Asmalldevelopers

Description

@Asmalldevelopers

Plugin Version

Next-2.0.6

AstrBot Version

v4.18.3

Database Type

SQLite (default)

Operating System

Linux

Bug Description

无法启动插件

Steps to Reproduce

1.更新至最新版本;
2.重载插件

Expected Behavior

正常装载插件

Error Logs

[2026-03-10 22:51:33.064] [Core] [INFO] [star.star_manager:555]: 正在载入插件 astrbot_plugin_self_learning ...
[2026-03-10 22:51:33.105] [Core] [INFO] [star.star_manager:634]: Plugin astrbot_plugin_self_learning (Next-2.0.6) by NickMo: SELF LEARNING 自主学习插件 — 让 AI 聊天机器人自主学习对话风格、理解群组黑话、管理社交关系与好感度、自适应人格演化,像真人一样自然对话。(使用前必须手动备份人格数据)
[2026-03-10 22:51:33.105] [Plug] [INFO] [astrbot_plugin_self_learning.main:81]: 使用用户自定义数据路径 (从Storage_Settings.data_dir): ./data/self_learning_data
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.main:91]: 最终插件数据目录: /AstrBot/data/self_learning_data
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.config:214]:  [配置加载] Model_Configuration原始数据: {'filter_provider_id': 'deepseek/deepseek-chat', 'refine_provider_id': 'moonshot/kimi-k2.5', 'reinforce_provider_id': 'moonshot/kimi-k2.5'}
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.config:215]:  [配置加载] filter_provider_id: deepseek/deepseek-chat
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.config:216]:  [配置加载] refine_provider_id: moonshot/kimi-k2.5
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.config:217]:  [配置加载] reinforce_provider_id: moonshot/kimi-k2.5
[2026-03-10 22:51:33.106] [Plug] [INFO] [astrbot_plugin_self_learning.config:236]:  [配置加载] Goal_Driven_Chat_Settings原始数据: {'enable_goal_driven_chat': False, 'goal_session_timeout_hours': 24, 'goal_auto_detect': True, 'goal_max_conversation_history': 40}
[2026-03-10 22:51:33.107] [Plug] [INFO] [astrbot_plugin_self_learning.config:237]:  [配置加载] enable_goal_driven_chat: False
[2026-03-10 22:51:33.107] [Plug] [INFO] [astrbot_plugin_self_learning.main:94]: [插件初始化] Provider配置已加载:
[2026-03-10 22:51:33.107] [Plug] [INFO] [astrbot_plugin_self_learning.main:95]:  - filter_provider_id: deepseek/deepseek-chat
[2026-03-10 22:51:33.107] [Plug] [INFO] [astrbot_plugin_self_learning.main:96]:  - refine_provider_id: moonshot/kimi-k2.5
[2026-03-10 22:51:33.107] [Plug] [INFO] [astrbot_plugin_self_learning.main:97]:  - reinforce_provider_id: moonshot/kimi-k2.5
[2026-03-10 22:51:33.494] [Plug] [INFO] [core.patterns:321]: 注册服务: database_manager
[2026-03-10 22:51:33.494] [Plug] [INFO] [core.factory:254]: 创建数据库管理器成功 (实现: SQLAlchemyDatabaseManager)
[2026-03-10 22:51:33.501] [Plug] [ERRO] [v4.18.3] [core.factory:114]: 导入消息收集器失败: No module named 'cachetools'
Traceback (most recent call last):
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/core/factory.py", line 105, in create_message_collector
    from ..services.core_learning import MessageCollectorService
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/services/core_learning/__init__.py", line 5, in <module>
    from .v2_learning_integration import V2LearningIntegration
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/services/core_learning/v2_learning_integration.py", line 40, in <module>
    from ...utils.cache_manager import get_cache_manager
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/utils/cache_manager.py", line 9, in <module>
    from cachetools import TTLCache, LRUCache, Cache
ModuleNotFoundError: No module named 'cachetools'
[2026-03-10 22:51:33.506] [Plug] [ERRO] [v4.18.3] [core.plugin_lifecycle:259]: 自学习服务初始化失败: 创建消息收集器失败: No module named 'cachetools'
[2026-03-10 22:51:33.506] [Plug] [ERRO] [v4.18.3] [astrbot_plugin_self_learning.main:137]: 插件服务编排失败,部分功能将不可用: 创建消息收集器失败: No module named 'cachetools'
Traceback (most recent call last):
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/core/factory.py", line 105, in create_message_collector
    from ..services.core_learning import MessageCollectorService
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/services/core_learning/__init__.py", line 5, in <module>
    from .v2_learning_integration import V2LearningIntegration
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/services/core_learning/v2_learning_integration.py", line 40, in <module>
    from ...utils.cache_manager import get_cache_manager
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/utils/cache_manager.py", line 9, in <module>
    from cachetools import TTLCache, LRUCache, Cache
ModuleNotFoundError: No module named 'cachetools'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/main.py", line 133, in __init__
    self._lifecycle.bootstrap(
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/core/plugin_lifecycle.py", line 51, in bootstrap
    p.message_collector = p.service_factory.create_message_collector()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/core/factory.py", line 34, in wrapper
    result = func(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/data/plugins/astrbot_plugin_self_learning/core/factory.py", line 115, in create_message_collector
    raise ServiceError(f"创建消息收集器失败: {str(e)}")
data.plugins.astrbot_plugin_self_learning.exceptions.ServiceError: 创建消息收集器失败: No module named 'cachetools'
[2026-03-10 22:51:33.512] [Plug] [INFO] [astrbot_plugin_self_learning.main:141]: 自学习插件初始化完成
[2026-03-10 22:51:33.512] [Plug] [INFO] [core.plugin_lifecycle:314]: 开始执行 on_load 方法
[2026-03-10 22:51:33.512] [Plug] [INFO] [core.plugin_lifecycle:323]: 尝试启动数据库管理器 (第 1/3 次)
[2026-03-10 22:51:33.513] [Plug] [INFO] [database.sqlalchemy_database_manager:66]: [DomainRouter] 开始启动…
[2026-03-10 22:51:33.514] [Plug] [INFO] [database.engine:62]: [DatabaseEngine] 数据库引擎初始化成功
[2026-03-10 22:51:33.514] [Plug] [INFO] [database.sqlalchemy_database_manager:74]: [DomainRouter] 数据库引擎已创建
[2026-03-10 22:51:33.622] [Plug] [INFO] [database.engine:239]: [DatabaseEngine] 数据库表结构同步完成
[2026-03-10 22:51:33.793] [Plug] [INFO] [database.sqlalchemy_database_manager:131]: [DomainRouter] 11 个领域 Facade 已初始化
[2026-03-10 22:51:33.793] [Plug] [INFO] [database.sqlalchemy_database_manager:82]: [DomainRouter] 数据库启动成功
[2026-03-10 22:51:33.793] [Plug] [INFO] [core.plugin_lifecycle:326]: 数据库管理器启动完成
[2026-03-10 22:51:33.793] [Plug] [INFO] [core.plugin_lifecycle:401]: 自学习插件加载完成

Relevant Configuration

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions