nonebot / plugin-apscheduler

APScheduler Support for NoneBot2
https://nonebot.dev/docs/best-practice/scheduler
MIT License
85 stars 10 forks source link

linux下插件无法加载 #54

Closed jyxjyx1234 closed 1 month ago

jyxjyx1234 commented 1 month ago

python版本3.11,fastapi为最新版,虚拟环境下有nonebot_plugin_apscheduler,..windows下加载没有问题. image

    timing = require("nonebot_plugin_apscheduler").scheduler
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 188, in require
    raise RuntimeError(f'Cannot load plugin "{name}"!')
RuntimeError: Cannot load plugin "nonebot_plugin_apscheduler"!
yanyongyu commented 1 month ago

请提供完整加载日志

jyxjyx1234 commented 1 month ago
Using python: /home/lighthouse/birth_bot/.venv/bin/python
10-13 17:27:23 [SUCCESS] nonebot | NoneBot is initializing...
10-13 17:27:23 [INFO] nonebot | Current Env: prod
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "invite" from "plugins.invite"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "help" from "plugins.help"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "2dfan" from "plugins.2dfan"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "divination" from "plugins.divination"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "downloadgame" from "plugins.downloadgame"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "v50" from "plugins.v50"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "img" from "plugins.img"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "welcome" from "plugins.welcome"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "latex" from "plugins.latex"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "vndbapi" from "plugins.vndbapi"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "couple" from "plugins.couple"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "voice" from "plugins.voice"
10-13 17:27:23 [WARNING] nonebot | Duplicated prefix rule "/zuoaizuoai"
10-13 17:27:23 [SUCCESS] nonebot | Succeeded to load plugin "xianliu" from "plugins.xianliu"
10-13 17:27:24 [ERROR] nonebot | Failed to import "nonebot_plugin_apscheduler"
Traceback (most recent call last):
  File "/home/lighthouse/birth_bot/bot.py", line 9, in <module>
    nonebot.load_plugins("plugins")
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 51, in load_plugins
    return manager.load_all_plugins()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 203, in load_all_plugins
    return set(
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 204, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 169, in load_plugin
    module = importlib.import_module(self._searched_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/plugins/birthday/__init__.py", line 1, in <module>
    from .timing import *
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/plugins/birthday/timing.py", line 47, in <module>
    timing = require("nonebot_plugin_apscheduler").scheduler
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 185, in require
    plugin = load_plugin(name)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 40, in load_plugin
    return manager.load_plugin(module_path)
> File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 167, in load_plugin
    module = importlib.import_module(self._third_party_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot_plugin_apscheduler/__init__.py", line 28, in <module>
    scheduler = AsyncIOScheduler()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 97, in __init__
    self.configure(gconfig, **options)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 141, in configure
    self._configure(config)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/asyncio.py", line 46, in _configure
    super(AsyncIOScheduler, self)._configure(config)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 711, in _configure
    self.timezone = astimezone(config.pop('timezone', None)) or get_localzone()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 219, in get_localzone
    _cache_tz = _get_localzone()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 180, in _get_localzone
    tzname = _get_localzone_name(_root)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 159, in _get_localzone_name
    raise zoneinfo.ZoneInfoNotFoundError(message)
zoneinfo._common.ZoneInfoNotFoundError: 'Multiple conflicting time zone configurations found:\n/etc/timezone: US/Eastern\n/etc/localtime is a symlink to: Asia/Shanghai\nFix the configuration, or set the time zone in a TZ environment variable.\n'
10-13 17:27:24 [ERROR] nonebot | Failed to import "birthday"
Traceback (most recent call last):
  File "/home/lighthouse/birth_bot/bot.py", line 9, in <module>
    nonebot.load_plugins("plugins")
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 51, in load_plugins
    return manager.load_all_plugins()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 203, in load_all_plugins
    return set(
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 204, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 169, in load_plugin
    module = importlib.import_module(self._searched_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/plugins/birthday/__init__.py", line 1, in <module>
    from .timing import *
  File "/home/lighthouse/birth_bot/plugins/birthday/timing.py", line 47, in <module>
    timing = require("nonebot_plugin_apscheduler").scheduler
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 188, in require
    raise RuntimeError(f'Cannot load plugin "{name}"!')
RuntimeError: Cannot load plugin "nonebot_plugin_apscheduler"!
10-13 17:27:24 [WARNING] nonebot | Duplicated prefix rule "/chat"
10-13 17:27:24 [WARNING] nonebot | Duplicated prefix rule "/aidraw"
10-13 17:27:24 [SUCCESS] nonebot | Succeeded to load plugin "gpt" from "plugins.gpt"
10-13 17:27:24 [ERROR] nonebot | Failed to import "nonebot_plugin_apscheduler"
Traceback (most recent call last):
  File "/home/lighthouse/birth_bot/bot.py", line 9, in <module>
    nonebot.load_plugins("plugins")
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 51, in load_plugins
    return manager.load_all_plugins()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 203, in load_all_plugins
    return set(
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 204, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 169, in load_plugin
    module = importlib.import_module(self._searched_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/plugins/stats/__init__.py", line 89, in <module>
    dally_stats = require("nonebot_plugin_apscheduler").scheduler
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 181, in require
    plugin = manager.load_plugin(name)
> File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 167, in load_plugin
    module = importlib.import_module(self._third_party_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot_plugin_apscheduler/__init__.py", line 28, in <module>
    scheduler = AsyncIOScheduler()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 97, in __init__
    self.configure(gconfig, **options)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 141, in configure
    self._configure(config)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/asyncio.py", line 46, in _configure
    super(AsyncIOScheduler, self)._configure(config)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/apscheduler/schedulers/base.py", line 711, in _configure
    self.timezone = astimezone(config.pop('timezone', None)) or get_localzone()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 219, in get_localzone
    _cache_tz = _get_localzone()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 180, in _get_localzone
    tzname = _get_localzone_name(_root)
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/tzlocal/unix.py", line 159, in _get_localzone_name
    raise zoneinfo.ZoneInfoNotFoundError(message)
zoneinfo._common.ZoneInfoNotFoundError: 'Multiple conflicting time zone configurations found:\n/etc/timezone: US/Eastern\n/etc/localtime is a symlink to: Asia/Shanghai\nFix the configuration, or set the time zone in a TZ environment variable.\n'
10-13 17:27:24 [ERROR] nonebot | Failed to import "stats"
Traceback (most recent call last):
  File "/home/lighthouse/birth_bot/bot.py", line 9, in <module>
    nonebot.load_plugins("plugins")
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 51, in load_plugins
    return manager.load_all_plugins()
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 203, in load_all_plugins
    return set(
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 204, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 169, in load_plugin
    module = importlib.import_module(self._searched_plugin_ids[name])
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lighthouse/birth_bot/plugins/stats/__init__.py", line 89, in <module>
    dally_stats = require("nonebot_plugin_apscheduler").scheduler
  File "/home/lighthouse/birth_bot/.venv/lib/python3.11/site-packages/nonebot/plugin/load.py", line 188, in require
    raise RuntimeError(f'Cannot load plugin "{name}"!')
RuntimeError: Cannot load plugin "nonebot_plugin_apscheduler"!
yanyongyu commented 1 month ago

加载出错是因为你的系统时区配置不正确timezone和localtime不一致,请正确配置系统时区。

jyxjyx1234 commented 1 month ago

好的,非常感谢