sh0nk / matplotlib4j

Matplotlib for java: A simple graph plot library for java, scala and kotlin with powerful python matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MACOS Apple M1 Pro an exception occurred

bigfish1913 opened this issue · comments

com.github.sh0nk.matplotlib4j.PythonExecutionException: Python execution error: Traceback (most recent call last):
File "/Users/xxx/Library/Python/3.8/lib/python/site-packages/numpy/core/init.py", line 23, in
from . import multiarray
File "/Users/xxxx/Library/Python/3.8/lib/python/site-packages/numpy/core/multiarray.py", line 10, in
from . import overrides
File "/Users/xxxx/Library/Python/3.8/lib/python/site-packages/numpy/core/overrides.py", line 6, in
from numpy.core._multiarray_umath import (
ImportError: dlopen(/Users/xxxx/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so, 0x0002): tried: '/Users/xxxx/Library/Python/3.8/lib/python/site-packages/numpy/core/_multiarray_umath.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/_multiarray_umath.cpython-38-darwin.so' (no such file), '/usr/lib/_multiarray_umath.cpython-38-darwin.so' (no such file)

@fuwei199006 Thanks for the feedback. Could you also point out which method call on java raised the exception?

When Java calls Python and imports numpy library . This doesn't seem to be the problem with this component。

#coding=utf-8
import numpy as np
print(1+2)
print("==============")
x = np.array(range(0, 50))
print(x)

Call in Java to try this

@fuwei199006
Sorry for replying so late. I have finally tried to test on Mac with Apple Silicon. But if numpy is correctly installed with python 3.9, I haven't seen that error. With another Python version, I also struggled to install the library, so please check if numpy is correctly installed first. ref: https://stackoverflow.com/questions/71745890/incompatible-architecture-have-arm64-need-x86-64-error-while-installing