[bug]插件导入失败
sherlockHlb opened this issue · 3 comments
03-26 15:12:25 [ERROR] nonebot | Failed to import "nonebot_bison"
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot\bot.py", line 14, in
nonebot.load_from_toml("pyproject.toml")
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\load.py", line 122, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\load.py", line 59, in load_all_plugins
return manager.load_all_plugins()
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 168, in load_all_plugins
return set(
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 169, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1206, in gcd_import
File "", line 1178, in find_and_load
File "", line 1149, in find_and_load_unlocked
File "", line 690, in load_unlocked
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot\plugin\manager.py", line 233, in exec_module
super().exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison_init.py", line 5, in
from . import (
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\admin_page_init.py", line 17, in
from .api import router as api_router
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\admin_page\api.py", line 8, in
from ..apis import check_sub_target
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\apis.py", line 2, in
from .scheduler import scheduler_dict
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\scheduler_init.py", line 1, in
from .manager import *
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\scheduler\manager.py", line 3, in
from ..config import config
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\config_init.py", line 1, in
from .db_config import config
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\nonebot_bison\config\db_config.py", line 8, in
from sqlmodel import delete, func, select
File "C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\sqlmodel_init.py", line 24, in
from sqlalchemy.schema import ThreadLocalMetaData as ThreadLocalMetaData
ImportError: cannot import name 'ThreadLocalMetaData' from 'sqlalchemy.schema' (C:\Users\Administrator\Desktop\NBBOOT\FistBot.venv\Lib\site-packages\sqlalchemy\schema.py)
03-26 15:12:25 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_moyu"
根据报错信息可以看出,导入nonebot_bison插件失败了,原因是导入该插件时导入了sqlalchemy的ThreadLocalMetaData模块,但是该模块在sqlalchemy.schema中找不到。
可能的原因是sqlalchemy库版本太低或者安装不正确,或者nonebot_bison库中的代码有问题。
您可以尝试升级sqlalchemy库或重新安装nonebot_bison库。另外,您也可以在导入nonebot_bison之前先尝试单独导入sqlalchemy.schema,看看是否能正常导入。
但是并没有sqlalchemy库
nonebot-bison版本?
nonebot-plugin-datastore版本?
考虑使用pip install nonebot-bison==0.7.1 -i https://pypi.python.org/simple
来安装最新的版本