clj-python / clj-python/libpython-clj

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

Open
#186 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.2k
Forks
74
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at libpython-clj2/python.clj:87 and the initialize! function, then locate the relevant documentation for setup and architecture requirements. Confirm how JVM and Python architectures are obtained, document the matching requirement, and make sure initialization reports a clear error when they differ.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, python
Domain
backend, documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.