andrewssobral / andrewssobral/bgslibrary

Importing python library on M1 chip MacOS

Open
#209 1 comment 1 reaction 1 assignee Claimed by @andrewssobral View on GitHub
bug to fix to investigate
Dominant language
C++
Stars
2.3k
Forks
735
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.