MineContext icon indicating copy to clipboard operation
MineContext copied to clipboard

[BUG]: v0.1.5 Fails to Launch on Apple Silicon (arm64) due to numpy ImportError

Open moqiank opened this issue 1 month ago • 2 comments

🐛 Bug description [Please make everyone to understand it]

The application fails to launch after a clean installation of v0.1.5 on an Apple Silicon (M1 Pro) Mac. The main application window opens but remains blank or stuck on a loading screen, and the application is unresponsive. The backend debug log clearly indicates that the backend process crashes immediately upon startup. The crash is caused by a fatal ImportError related to the numpy library. The specific error message is Error importing numpy: you should not try to import numpy from its source directory.... This strongly suggests a critical issue with how the Python dependencies, particularly numpy, were packaged within the arm64 version of the application for release. The issue appears to be internal to the application's bundled environment.

🧑‍💻 Step to reproduce

在一台搭载 Apple Silicon 芯片 (如 M1, M2, M3) 的 Mac 上操作。 我之前的版本是 0.1.3 (可正常运行)。 下载官方发布的 MineContext-0.1.5.dmg 文件。 双击打开 .dmg 文件,将 MineContext.app 拖拽到“应用程序”文件夹中,选择“替换”(Replace) 以覆盖旧版本。 从“应用程序”文件夹中启动 MineContext。 应用随即卡在空白加载界面,无法使用。 查看位于 ~/Library/Logs/MineContext/backend-debug.log 的日志文件,可以看到与 numpy 相关的 ImportError。

👾 Expected result

应用应该能成功启动,主界面能够正常显示并可以进行操作。

🚑 Any additional information

=== VIKINGDB Backend Debug Log === Started: 2025-11-17T05:22:36.312Z Platform: darwin Architecture: arm64 Node version: v22.18.0 Electron version: 37.3.0 Process execPath: /Applications/MineContext.app/Contents/MacOS/MineContext Process cwd: / __dirname: /Applications/MineContext.app/Contents/Resources/app.asar/out/main Resources path: /Applications/MineContext.app/Contents/Resources Is packaged: true Actually dev: false

[2025-11-17T05:22:36.313Z] Initial backend startup... [2025-11-17T05:22:36.328Z] Found available port: 1733 [2025-11-17T05:22:36.329Z] Starting backend with command: /Applications/MineContext.app/Contents/Resources/backend/main start --port 1733 --config config/config.yaml, Working dir: /Applications/MineContext.app/Contents/Resources/backend, Environment: CONTEXT_PATH=/Users/kunqian/Library/Application Support/MineContext [2025-11-17T05:22:36.330Z] Backend server started [2025-11-17T05:22:36.682Z] Health check attempt 1/20 - checking http://1227.0.0.1:1733/api/health [2025-11-17T05:22:36.689Z] Health check request error: connect ECONNREFUSED 127.0.0.1:1733 [2025-11-17T05:22:36.689Z] ❌ Health check attempt 1 failed: connect ECONNREFUSED 127.0.0.1:1733 (code: ECONNREFUSED) [2025-11-17T05:22:36.689Z] Retrying in 20000ms... [2025-11-17T05:22:57.539Z] STDERR: Traceback (most recent call last): File "cli.py", line 23, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/server/api.py", line 17, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/server/routes/content_generation.py", line 16, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/server/opencontext.py", line 23, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/server/component_initializer.py", line 26, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/init.py", line 10, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/merger/init.py", line 12, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/merger/context_merger.py", line 23, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/processor/init.py", line 14, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/processor/document_processor.py", line 20, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/chunker/init.py", line 9, in File "pyimod02_importers.py", line 457, in exec_module File "opencontext/context_processing/chunker/chunkers.py", line 20, in File "pyimod02_importers.py", line 457, in exec_module File "pandas/init.py", line 19, in ImportError: Unable to import required dependencies: numpy: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. [PYI-45419:ERROR] Failed to execute script 'cli' due to unhandled exception!

[2025-11-17T05:22:57.770Z] Backend process exited with code 1 [2025-11-17T05:22:57.770Z] Backend status changed from starting to stopped [2025-11-17T05:22:57.770Z] Backend status changed from stopped to error [2025-11-17T05:22:57.770Z] Failed to start backend: Backend process exited with code 1 [2025-11-17T05:22:57.770Z] ❌ Backend initialization failed: Backend process exited with code 1

🛠️ MineContext Version

0.1.5

💻 Platform Details

操作系统 (Operating System): macOS Monterey 版本 (Version): 12.6 硬件详情 (Additional Details): MacBook Pro with Apple M1 Pro chip (arm64 architecture)

moqiank avatar Nov 17 '25 06:11 moqiank

0.1.6 可以运行吗

qin-ctx avatar Nov 18 '25 06:11 qin-ctx

0.1.6 可以运行吗

测试了还是无法正常打开

=== VIKINGDB Backend Debug Log === Started: 2025-11-18T08:36:56.157Z Platform: darwin Architecture: arm64 Node version: v22.18.0 Electron version: 37.3.0 Process execPath: /Applications/MineContext.app/Contents/MacOS/MineContext Process cwd: / __dirname: /Applications/MineContext.app/Contents/Resources/app.asar/out/main Resources path: /Applications/MineContext.app/Contents/Resources Is packaged: true Actually dev: false

[2025-11-18T08:36:56.157Z] Initial backend startup... [2025-11-18T08:36:56.157Z] Backend process is not running, starting... [2025-11-18T08:36:56.157Z] Backend status changed from stopped to starting [2025-11-18T08:36:56.174Z] Found available port: 1733 [2025-11-18T08:36:56.174Z] Selected backend port: 1733 [2025-11-18T08:36:56.175Z] Initial resources path: /Applications/MineContext.app/Contents/Resources [2025-11-18T08:36:56.175Z] Adjusted resources path from asar: /Applications/MineContext.app/Contents/Resources/ [2025-11-18T08:36:56.175Z] Searching for backend executable in 13 locations: [2025-11-18T08:36:56.175Z] Checking: /Applications/MineContext.app/Contents/Resources/backend/main [2025-11-18T08:36:56.175Z] ✅ Found! Size: 90552144 bytes, Modified: Tue Nov 18 2025 15:08:44 GMT+0800 (中国标准时间) [2025-11-18T08:36:56.175Z] File mode: 100755 (executable: true) [2025-11-18T08:36:56.175Z] Starting backend server on port 1733: /Applications/MineContext.app/Contents/Resources/backend/main [2025-11-18T08:36:56.175Z] Using working directory: /Applications/MineContext.app/Contents/Resources/backend [2025-11-18T08:36:56.175Z] Config path: /Applications/MineContext.app/Contents/Resources/backend/config/config.yaml [2025-11-18T08:36:56.175Z] Config exists: true [2025-11-18T08:36:56.175Z] Starting backend with command: /Applications/MineContext.app/Contents/Resources/backend/main start --port 1733 --config config/config.yaml, Working dir: /Applications/MineContext.app/Contents/Resources/backend, Environment: CONTEXT_PATH=/Users/kunqian/Library/Application Support/MineContext [2025-11-18T08:36:56.186Z] Created new process group for PID: 14476 [2025-11-18T08:36:56.186Z] Backend server started [2025-11-18T08:36:56.475Z] Health check attempt 1/20 - checking http://127.0.0.1:1733/api/health [2025-11-18T08:36:56.486Z] Health check request error: connect ECONNREFUSED 127.0.0.1:1733 [2025-11-18T08:36:56.486Z] ❌ Health check attempt 1 failed: connect ECONNREFUSED 127.0.0.1:1733 (code: ECONNREFUSED) [2025-11-18T08:36:56.486Z] Retrying in 20000ms... [2025-11-18T08:37:16.488Z] Health check attempt 2/20 - checking http://127.0.0.1:1733/api/health [2025-11-18T08:37:16.490Z] Health check request error: connect ECONNREFUSED 127.0.0.1:1733 [2025-11-18T08:37:16.491Z] ❌ Health check attempt 2 failed: connect ECONNREFUSED 127.0.0.1:1733 (code: ECONNREFUSED) [2025-11-18T08:37:16.491Z] Retrying in 20000ms... [2025-11-18T08:37:16.661Z] STDERR: Traceback (most recent call last): File "cli.py", line 23, in File "opencontext/server/api.py", line 17, in File "opencontext/server/routes/content_generation.py", line 16, in File "opencontext/server/opencontext.py", line 23, in File "opencontext/server/component_initializer.py", line 26, in File "opencontext/context_processing/init.py", line 10, in File "opencontext/context_processing/merger/init.py", line 12, in File "opencontext/context_processing/merger/context_merger.py", line 23, in File "opencontext/context_processing/processor/init.py", line 14, in File "opencontext/context_processing/processor/document_processor.py", line 20, in File "opencontext/context_processing/chunker/init.py", line 9, in File "opencontext/context_processing/chunker/chunkers.py", line 20, in File "pandas/init.py", line 19, in ImportError: Unable to import required dependencies: numpy: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there. [PYI-14487:ERROR] Failed to execute script 'cli' due to unhandled exception!

[2025-11-18T08:37:17.047Z] Backend process exited with code 1 [2025-11-18T08:37:17.047Z] Backend status changed from starting to stopped [2025-11-18T08:37:17.047Z] Backend status changed from stopped to error [2025-11-18T08:37:17.047Z] Failed to start backend: Backend process exited with code 1 [2025-11-18T08:37:17.047Z] ❌ Backend initialization failed: Backend process exited with code 1 [2025-11-18T08:37:17.050Z] Error stack: Error: Backend process exited with code 1 at ChildProcess. (/Applications/MineContext.app/Contents/Resources/app.asar/out/main/index.js:69373:18) at ChildProcess.emit (node:events:518:28) at maybeClose (node:internal/child_process:1101:16) at Socket. (node:internal/child_process:456:11) at Socket.emit (node:events:518:28) at Pipe. (node:net:346:12) [2025-11-18T08:38:05.939Z] Health check attempt 3/20 - checking http://127.0.0.1:1733/api/health [2025-11-18T08:38:05.954Z] Health check request error: connect ECONNREFUSED 127.0.0.1:1733 [2025-11-18T08:38:05.954Z] ❌ Health check attempt 3 failed: connect ECONNREFUSED 127.0.0.1:1733 (code: ECONNREFUSED) [2025-11-18T08:38:05.954Z] Retrying in 20000ms... [2025-11-18T08:38:12.965Z] Synchronously stopping backend server... [2025-11-18T08:38:12.965Z] Sending SIGTERM to process group -14476 [2025-11-18T08:38:12.966Z] Error in sync stop: Error: kill ESRCH [2025-11-18T08:38:13.031Z] No process found on port 1733 or error: Command failed: lsof -ti:1733 [2025-11-18T08:38:13.031Z] Synchronous backend stop completed

更新后问题依然存在。应用的启动表现和 0.1.5 版本完全相同,依然因为一模一样的 numpy ImportError 而崩溃。

moqiank avatar Nov 18 '25 08:11 moqiank