lgc-NB2Dev / nonebot-plugin-picmcstat

A NoneBot2 plugin generates a pic from a Minecraft server's MOTD
MIT License
17 stars 3 forks source link

Failed to import "nonebot_plugin_picmcstat" #20

Closed mcxiaochenn closed 6 months ago

mcxiaochenn commented 6 months ago

05-19 15:33:18 [ERROR] nonebot | Failed to import "nonebot_plugin_picmcstat" Traceback (most recent call last): File "", line 1, in File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 122, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 131, in _main prepare(preparation_data) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 246, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 297, in _fixup_main_from_path main_content = runpy.run_path(main_path, File "", line 286, in run_path File "", line 98, in _run_module_code File "", line 88, in _run_code File "C:\Users\admin\Desktop\nonebot\QQ-bot\bot.py", line 30, in nonebot.load_from_toml("pyproject.toml") File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\load.py", line 131, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\load.py", line 65, in load_all_plugins return manager.load_all_plugins() File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\manager.py", line 203, in load_all_plugins return set( File "C:\Users\admin\AppData\Local\Programs\Python\Python312\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\admin\AppData\Local\Programs\Python\Python312\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\admin\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\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\manager.py", line 255, in exec_module super().exec_module(module) File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat__init.py", line 5, in from . import main as main # noqa: E402 File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat\main.py", line 11, in from .draw import ServerType, draw File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat\draw.py", line 16, in from pil_utils import BuildImage, Text2Image File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\init.py", line 1, in from .build_image import BuildImage as BuildImage File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\build_image.py", line 15, in from .text2image import Text2Image File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\text2image.py", line 11, in from .fonts import Font, get_proper_font File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\fonts.py", line 6, in from matplotlib.font_manager import FontProperties, fontManager File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\init.py", line 276, in _check_versions() File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\init__.py", line 270, in _check_versions module = importlib.import_module(modname) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\importlib\init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\kiwisolver\init__.py", line 8, in from ._cext import (

lgc2333 commented 6 months ago

报错信息不全,不过看起来好像是vc运行库的问题,尝试安装vc运行库

https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

mcxiaochenn commented 6 months ago

我再试试

mcxiaochenn commented 6 months ago

安装vc并重启后尝试更换环境,使用虚拟环境运行后提示

Failed to import "nonebot_plugin_picmcstat" Traceback (most recent call last): File "", line 1, in File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 122, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 131, in _main prepare(preparation_data) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 246, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 297, in _fixup_main_from_path main_content = runpy.run_path(main_path, File "", line 286, in run_path File "", line 98, in _run_module_code File "", line 88, in _run_code File "C:\Users\admin\Desktop\nonebot\New-QQ-Bot2\bot.py", line 30, in nonebot.load_from_toml("pyproject.toml") File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\load.py", line 131, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\load.py", line 65, in load_all_plugins return manager.load_all_plugins() File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\manager.py", line 203, in load_all_plugins return set( File "C:\Users\admin\AppData\Local\Programs\Python\Python312\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\admin\AppData\Local\Programs\Python\Python312\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\admin\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\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot\plugin\manager.py", line 255, in exec_module super().exec_module(module) File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat__init.py", line 5, in from . import main as main # noqa: E402 File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat\main.py", line 11, in from .draw import ServerType, draw File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\nonebot_plugin_picmcstat\draw.py", line 16, in from pil_utils import BuildImage, Text2Image File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\init.py", line 1, in from .build_image import BuildImage as BuildImage File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\build_image.py", line 15, in from .text2image import Text2Image File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\text2image.py", line 11, in from .fonts import Font, get_proper_font File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\pil_utils\fonts.py", line 6, in from matplotlib.font_manager import FontProperties, fontManager File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\init.py", line 276, in _check_versions() File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\init__.py", line 270, in _check_versions module = importlib.import_module(modname) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\importlib\init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\kiwisolver\init__.py", line 8, in from ._cext import ( ImportError: DLL load failed while importing _cext: 找不到指定的模块。

系统是winserver2016,查找过往案例尝试使用-U安装依旧没有解决,看路径似乎没有使用虚拟环境中的python,有点懵

lgc2333 commented 6 months ago

确认你安装了最新的vc redist,如果还不行请重启服务器

mcxiaochenn commented 6 months ago

搞到现在才弄好,原因是python无法调用系统内的vc运行库,由于我安装的是py12导致没有msvc-runtime这个库,降级到python11后pip install msvc-runtime最后解决,现在还有个问题是很多服务器无法连接上(相同网络环境下可以连接上)举个例子

hqf.icu提示getaddrinfo failed hypixel.net、syuu.net提示ConnectionRefusedError: [Errno 10061] Connect call failed (103.116.76.242', 19191)ConnectionRefusedError: [Errno 10061] Connect call failed (103.116.76.242', 19191)

lgc2333 commented 6 months ago

https://github.com/lgc-NB2Dev/nonebot-plugin-picmcstat?tab=readme-ov-file#mcstat_resolve_dns---%E6%98%AF%E5%90%A6%E7%94%B1%E6%8F%92%E4%BB%B6%E8%A7%A3%E6%9E%90-dns-%E8%AE%B0%E5%BD%95

mcxiaochenn commented 6 months ago

感谢