bot-ssttkkl / nonebot-plugin-access-control

Nonebot 权限控制插件
MIT License
43 stars 2 forks source link

插件可能出现问题,导致整个nonebot打不开 #33

Closed liuyuhang9066 closed 1 month ago

liuyuhang9066 commented 2 months ago

OS:Windows Server 2016 DataCenter Python版本:Python 3.12.5 问题:在安装插件前一切正常,但是不知道为什么安装之后启动nonebot突然就启动不起来了,提示No module named 'pkg_resources',然后Nonebot就整个崩溃了 复现方式:安装后就会出现 C:\Users\Administrator\Desktop\qbot>nb run 使用 Python: C:\Users\Administrator\Desktop\qbot.venv\Scripts\python.exe 08-19 18:05:19 [SUCCESS] nonebot | NoneBot is initializing... 08-19 18:05:19 [INFO] nonebot | Current Env: prod 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo" 08-19 18:05:20 [ERROR] nonebot | Failed to import "nonebot"Traceback (most recent call last): File "", line 14, in File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\load.py", line 131, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\load.py", line 65, in load_all_plugins return manager.load_all_plugins() File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 203, in load_all_plugins return set( File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 204, in filter(None, (self.load_plugin(name) for name in self.available_plugins))> File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 167, in load_plugin module = importlib.import_module(self._third_party_plugin_ids[name]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\importlib__init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1324, in _find_and_load_unlockedModuleNotFoundError: No module named 'OlivOS' 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_waiter" 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna:uniseg" from "nonebot_plugin_alconna.uniseg" 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna" 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session" 08-19 18:05:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_minesweeper" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_today_in_history" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_alconna" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_today_waifu"C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\pydantic_internal_config.py:341: UserWarning: Valid config keys have changed in V2:* 'orm_mode' has been renamed to 'from_attributes' warnings.warn(message, UserWarning)08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_saa" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_analysis_bilibili" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_heweather" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_saa" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_wordle" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_treehelp" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_eventmonitor" 08-19 18:05:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_userinfo" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_chess" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_kfcrazy" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_simplemusic" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_summon" 08-19 18:05:22 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session_orm" 08-19 18:05:24 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_memes" 08-19 18:05:24 [SUCCESS] nonebot_plugin_sky | 从模板导入命令成功 08-19 18:05:24 [SUCCESS] nonebot_plugin_sky | 全局命令配置读取成功,21 个命令已加载 08-19 18:05:24 [SUCCESS] nonebot_plugin_sky | 读取配置成功 08-19 18:05:24 [WARNING] nonebot_plugin_sky | 您还未配置接收小助手消息的群id,这个功能无法正常工作 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_sky" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_status" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_sticker_saver" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_handle" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_date_name" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_datastore" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_bottle" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_whateat_pic" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_access_control_api" 08-19 18:05:25 [INFO] nonebot_plugin_access_control | use inmemory rate_limit_token storage 08-19 18:05:25 [ERROR] nonebot | Failed to import "nonebot_plugin_access_control"Traceback (most recent call last): File "", line 14, in File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\load.py", line 131, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\load.py", line 65, in load_all_plugins return manager.load_all_plugins() File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 203, in load_all_plugins return set( File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 204, in filter(None, (self.load_plugin(name) for name in self.available_plugins))> File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 167, in load_plugin module = importlib.import_module(self._third_party_plugin_ids[name]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\importlib__init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 255, in exec_module super().exec_module(module) File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot_plugin_access_control__init__.py", line 36, in from . import datastore # noqa File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot_plugin_access_control\datastore\init.py", line 8, in from pkg_resources import DistributionNotFound, get_distributionModuleNotFoundError: No module named 'pkg_resources' 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_what2eat" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_pvz" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_memes_api" 08-19 18:05:25 [WARNING] nonebot | Duplicated prefix rule "/点赞漂流瓶" 08-19 18:05:25 [WARNING] nonebot | Duplicated prefix rule "/评论漂流瓶" 08-19 18:05:25 [WARNING] nonebot | Duplicated prefix rule "/查看漂流瓶" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_web_bottle" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_boardgame" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_cchess" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_kawaii_status" 08-19 18:05:25 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender" 08-19 18:05:25 [SUCCESS] nonebot | Running NoneBot... 08-19 18:05:25 [INFO] uvicorn | Started server process [55348] 08-19 18:05:25 [INFO] uvicorn | Waiting for application startup. 08-19 18:05:25 [INFO] nonebot_plugin_htmlrender | 使用 chromium 启动 08-19 18:05:26 [INFO] nonebot_plugin_htmlrender | Browser Started. 08-19 18:05:26 [INFO] nonebot_plugin_apscheduler | Scheduler Started 08-19 18:05:26 [INFO] nonebot_plugin_today_in_history | history_env: {} 08-19 18:05:26 [INFO] nonebot_plugin_today_in_history | history_env_all_group: False 08-19 18:05:26 [ERROR] uvicorn | Traceback (most recent call last): File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\starlette\routing.py", line 732, in lifespan async with self.lifespan_context(app) as maybe_state: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 210, in aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 153, in _lifespan_manager await self._lifespan.startup() File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\internal\driver_lifespan.py", line 42, in startup await self._run_lifespan_func(self._startup_funcs) File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot\internal\driver_lifespan.py", line 36, in _run_lifespan_func await cast(ASYNC_LIFESPAN_FUNC, func)() File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot_plugin_orm\init__.py", line 84, in init_orm await greenlet_spawn(migrate.check, alembic_config) File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 203, in greenlet_spawn result = context.switch(value) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\qbot.venv\Lib\site-packages\nonebot_plugin_orm\migrate.py", line 572, in check raise AutogenerateDiffsDetected(f"检测到新的升级操作:\n{pformat(diffs)}")nonebot_plugin_orm.exception.AutogenerateDiffsDetected: 检测到新的升级操作:[('add_table', Table('accctrl_permission', MetaData(), Column('subject', String(), table=, primary_key=True, nullable=False), Column('service', String(), table=, primary_key=True, nullable=False), Column('allow', Boolean(), table=, nullable=False), schema=None)), ('add_table', Table('accctrl_rate_limit_rule', MetaData(), Column('id', String(), table=, primary_key=True, nullable=False), Column('subject', String(), table=, nullable=False), Column('service', String(), table=, nullable=False), Column('time_span', Integer(), table=, nullable=False), Column('limit', Integer(), table=, nullable=False), Column('overwrite', Boolean(), table=, nullable=False), schema=None)), ('add_index', Index('ix_accctrl_rate_limit_rule_subject_service', Column('subject', String(), table=, nullable=False), Column('service', String(), table=, nullable=False))), ('add_table', Table('accctrl_rate_limit_token', MetaData(), Column('id', Integer(), table=, primary_key=True, nullable=False), Column('rule_id', String(), ForeignKey('accctrl_rate_limit_rule.id'), table=, nullable=False), Column('user', String(), table=, nullable=False), Column('acquire_time', DateTime(), table=, nullable=False), Column('expire_time', DateTime(), table=, nullable=False), schema=None)), ('add_index', Index('ix_accctrl_rate_limit_token_expire_time', Column('expire_time', DateTime(), table=, nullable=False))), ('add_index', Index('ix_accctrl_rate_limit_token_rule_id', Column('rule_id', String(), table=, nullable=False)))] 08-19 18:05:26 [ERROR] uvicorn | Application startup failed. Exiting. C:\Users\Administrator\Desktop\qbot>

sjxkfnskdd commented 2 months ago

+1,我也是这样

ssttkkl commented 2 months ago

python3.12的问题,可以先降级python试试

sjxkfnskdd commented 2 months ago

python3.12的问题,可以先降级python试试

使用python3.11加载成功