Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing python library on M1 chip MacOS #209

Open
xavibou opened this issue Apr 15, 2022 · 1 comment
Open

Importing python library on M1 chip MacOS #209

xavibou opened this issue Apr 15, 2022 · 1 comment

Comments

@xavibou
Copy link

xavibou commented Apr 15, 2022

Hi @andrewssobral,

I am having issues importing the python library with M1 chip MacOS. It seems to be related to the architecture of my machine. I describe my environment and how to reproduce the bug does below:

I have compiled bgslibrary with support for Python on MacOS as stated in https://github.com/andrewssobral/bgslibrary/wiki/Wrapper:-Python. The code compiled well using a Conda environment with the following installations:
-OpenCV 3.4.7
-Python 3.8.6 (Anaconda)

Compilation was done with:
cmake -D BGS_PYTHON_SUPPORT=ON ..

Then, I added the generated lib (pybgs.cpython-39-darwin.so) to my Python path:
export PYTHONPATH="${PYTHONPATH}:/Users/xavibou/Documents/repos/change_detection/methods/bgslibrary/build"

When try to run the demo with the command python demo.py, I get the following error:

Traceback (most recent call last):
File "/Users/xavibou/Documents/repos/change_detection/methods/bgslibrary/demo.py", line 3, in
import pybgs as bgs
ImportError: dlopen(/Users/xavibou/Documents/repos/change_detection/methods/bgslibrary/build/pybgs.cpython-39-darwin.so, 0x0002): tried: '/Users/xavibou/Documents/repos/change_detection/methods/bgslibrary/build/pybgs.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/pybgs.cpython-39-darwin.so' (no such file), '/usr/lib/pybgs.cpython-39-darwin.so' (no such file)

Thank you,
Xavi

@andrewssobral
Copy link
Owner

Hello @xavibou
Thanks for opening this issue.
Yes it's related to the architecture.
However, I need to investigate it more deeply, it's not clear to me how to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants