matplotlib4j icon indicating copy to clipboard operation
matplotlib4j copied to clipboard

MACOS Apple M1 Pro an exception occurred

Open bigfish1913 opened this issue 2 years ago • 3 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)

bigfish1913 avatar May 15 '22 14:05 bigfish1913

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

sh0nk avatar May 16 '22 02:05 sh0nk

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

bigfish1913 avatar May 16 '22 03:05 bigfish1913

@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

sh0nk avatar May 29 '22 09:05 sh0nk