Skip to content

Localstore is incompatible with Python3.14 #49

Closed

Description

@Tomorrowdawn

Python3.14中修改了底层执行逻辑(为了GIL),导致inspect行为不稳定,导致无法获得caller plugin.

(bot) tomorrowdawn@Tomorrowdawn:~/project/qqbot/bot$ nb orm upgrade
Using python: /home/tomorrowdawn/project/qqbot/bot/.venv/bin/python
WARNING: Legacy configuration format detected.
*** Use `nb upgrade-format` to upgrade to the new format.
01-12 22:49:00 [SUCCESS] nonebot | NoneBot is initializing...
01-12 22:49:00 [INFO] nonebot | Current Env: dev
01-12 22:49:01 [SUCCESS] nonebot | Succeeded to load plugin "message_logger" from "plugins.message_logger"
01-12 22:49:01 [SUCCESS] nonebot | Succeeded to load plugin "command_handler" from "plugins.command_handler"
01-12 22:49:01 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
Traceback (most recent call last):
  File "<string>", line 27, in <module>
    e.load()()
    ~~~~~~^^
  File "/home/tomorrowdawn/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/importlib/metadata/__init__.py", line 179, in load
    module = import_module(match.group('module'))
  File "/home/tomorrowdawn/.local/share/uv/python/cpython-3.14.0-linux-x86_64-gnu/lib/python3.14/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1398, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1314, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1398, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 762, in exec_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "/home/tomorrowdawn/project/qqbot/bot/.venv/lib/python3.14/site-packages/nonebot_plugin_orm/__init__.py", line 66, in <module>
    _data_dir = get_plugin_data_dir()
  File "/home/tomorrowdawn/project/qqbot/bot/.venv/lib/python3.14/site-packages/nonebot_plugin_localstore/__init__.py", line 74, in wrapper
    path = func(*args, **kwargs)
  File "/home/tomorrowdawn/project/qqbot/bot/.venv/lib/python3.14/site-packages/nonebot_plugin_localstore/__init__.py", line 180, in get_plugin_data_dir
    plugin = _try_get_caller_plugin()
  File "/home/tomorrowdawn/project/qqbot/bot/.venv/lib/python3.14/site-packages/nonebot_plugin_localstore/__init__.py", line 134, in _try_get_caller_plugin
    raise RuntimeError("Cannot detect caller 

Activity

  1. yanyongyu commented on Jan 12, 2026

    @yanyongyu
    Member

    有点奇怪,为什么会拿不到 caller plugin?能否在 get_caller_plugin 里打下日志,看看 module 和 module name 的值

  2. yanyongyu commented on Jan 12, 2026

    @yanyongyu
    Member

    另外试试 3.14.1 呢?

  3. yanyongyu commented on Jan 13, 2026

    @yanyongyu
    Member

    #51 添加了 3.14 的测试也没有遇到这个问题

  4. Tomorrowdawn commented on Jan 13, 2026

    @Tomorrowdawn
    Author

    https://github.com/Tomorrowdawn/nonebot-localstore-debug/blob/main/READ.md

    这是我的复现recipe. (uv还未提供3.14.1)

    我猜测有可能是以下几个问题:

    1. uv standalone python有不为人知的quirks.
    2. chat recorder及其使用的orm有黑魔法(毕竟这里看栈帧也是黑魔法)

    十分感谢您的及时回应。我也会在空余之时帮忙分析环境问题。

  5. yanyongyu commented on Jan 13, 2026

    @yanyongyu
    Member

    你可以升级 uv 来获取新版本 python

  6. yanyongyu commented on Jan 19, 2026

    @yanyongyu
    Member

    @Tomorrowdawn 是否还有问题?

  7. Tomorrowdawn commented on Jan 19, 2026

    @Tomorrowdawn
    Author

    我先关掉吧。我干脆自己手搓了一个来解决原先的问题。等我有时间来探查之后再打开。感谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions