clj-python / clj-python/libpython-clj

failure on macos M1 when JVM and python architecture do not match

未關閉
#186 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Clojure
星號
1.2k
分支
74
PR 合併指標
30 天內沒有已合併 PR

描述

I tried out libpython-clj and was facing the following error message:

"Execution error at libpython-clj2.python/initialize! (python.clj:87).
Failed to find a valid python library!"

The cause of this error was that I was using JVM for x86_64 via Rosetta and python was referencing to a native arm64.
After using a arm64 JVM it worked.
It took me quite some time to figure this out.

I think it would be helpful to mention in the docs that the architecture of python and jvm must match.
Further we could check this requirement during the initialize! function and return a proper error message.
This would improve user experience.
In the JVM we can check the architecture with:

(System/getProperty "os.arch")
This gives aarch64 or x86_64.
In python we can check the architecture with:

import platform
platform.machine()

on M1 this returns 'arm64'.

Hendrik

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 libpython-clj2/python.clj:87 和 initialize! 函式開始,接著找出與設定和架構需求相關的文件。確認如何取得 JVM 和 Python 的架構,記錄相符的需求,並確保初始化在兩者不一致時回報清楚的錯誤。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
clojure, python
領域
backend, documentation
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。