xiaowei-system/skills/devops/hermes-debug/references/hindsight-debug.md

54 lines
1.6 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Hindsight 安装故障记录2026-05-12
## 症状
`python3.12 -c "import hindsight"` 挂死,进程卡住不动,不抛异常也不超时。
`hindsight-embed daemon start` 也同样挂死。
## 根因定位过程
1. 所有 `hindsight_api` 子模块config, db_utils, response_models, search.*import 时全部卡死
2. `hindsight_client``hindsight_embed` 可以正常 import
3. 干净环境(`env -i HOME=/home/muc PATH=/usr/bin:/bin`)下依然卡死 → 不是环境变量
4. 所有子模块都卡 → 是 `hindsight_api` 包本身的导入机制问题
## 关键测试命令
```bash
# 确认卡在哪
stdbuf -oL -eL timeout 5 python3.12 -u -c "
import sys; sys.stdout.write('s\n'); sys.stdout.flush()
from hindsight_api import config
sys.stdout.write('ok\n')
" 2>&1
# 逐包测试
for pkg in hindsight_client hindsight_embed hindsight_api; do
timeout 5 python3.12 -c "import $pkg; print('${pkg}: ok')" 2>&1
done
```
## 环境信息
- hindsight 0.6.1 (from hindsight-all wheel, local install)
- hindsight_api_slim 0.6.1 (PyPI)
- hindsight-all 0.6.1 (local wheel)
- hindsight-client 0.6.1 (PyPI)
- hindsight-embed 0.6.1 (PyPI)
- Python 3.12.13, /usr/bin/python3.12
- 包路径: /home/muc/.local/lib/python3.12/site-packages/
## 结论
hindsight_api 包与当前 Python 环境不兼容。可能是:
- C 扩展模块(.so在 Python 3.12 上有 ABI 问题
- 或者包本身的 __init__.py 里有阻塞性操作
## 替代方案
使用 Mem0 代替 Hindsight
```bash
pip install --break-system-packages mem0ai
```
配置 `memory.provider: mem0` 在 ~/.hermes/config.yaml。
Mem0 优点:轻量、好装、官方支持好、支持本地向量存储。