bonsai: Error on importing bonsai on Mac M2/arm

Hi, I run in import errors when trying to use bonsai lib on MacBookPro M2 (arm9). Tested with 3.9,3.10 and 3.11 Trackback is pasted below. If I run the same import in Rosetta2 (x86) emulation environment it works perfectly.

Thanks for taking care

python 3.9

$ python
Python 3.9.16 (main, Dec  7 2022, 10:06:04)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bonsai
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/admin/tmp/venv/lib/python3.9/site-packages/bonsai/__init__.py", line 3, in <module>
    from .ldapconnection import LDAPConnection
  File "/Users/admin/tmp/venv/lib/python3.9/site-packages/bonsai/ldapconnection.py", line 5, in <module>
    from bonsai._bonsai import ldapconnection, ldapsearchiter
ImportError: dlopen(/Users/admin/tmp/venv/lib/python3.9/site-packages/bonsai/_bonsai.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_ldap_create_passwordpolicy_control'
$ pip3 freeze | grep bonsai
bonsai==1.5.1

python 3.10

$ python
Python 3.10.10 (main, Feb 16 2023, 02:49:39) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bonsai
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/admin/tmp/venv/lib/python3.10/site-packages/bonsai/__init__.py", line 3, in <module>
    from .ldapconnection import LDAPConnection
  File "/Users/admin/tmp/venv/lib/python3.10/site-packages/bonsai/ldapconnection.py", line 5, in <module>
    from bonsai._bonsai import ldapconnection, ldapsearchiter
ImportError: dlopen(/Users/admin/tmp/venv/lib/python3.10/site-packages/bonsai/_bonsai.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_ldap_create_passwordpolicy_control'
$ pip3 freeze | grep bonsai
bonsai==1.5.1

python 3.11

$ python
Python 3.11.2 (main, Feb 16 2023, 02:55:59) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bonsai
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/admin/tmp/venv/lib/python3.11/site-packages/bonsai/__init__.py", line 3, in <module>
    from .ldapconnection import LDAPConnection
  File "/Users/admin/tmp/venv/lib/python3.11/site-packages/bonsai/ldapconnection.py", line 5, in <module>
    from bonsai._bonsai import ldapconnection, ldapsearchiter
ImportError: dlopen(/Users/admin/tmp/venv/lib/python3.11/site-packages/bonsai/_bonsai.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_ber_pvt_opt_on'
$ pip3 freeze | grep bonsai
bonsai==1.5.1

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

The new release has been made. 1.5.3 is uploaded to PyPI.

Yes, of course.

It’s already done on the dev branch, actually. I just haven’t got the time to create a new release. I’ll try to make time for it this weekend.

I have an M1 Mac and a vested interest in getting an M1 compatible wheel going. Let me know if you want some help building/testing.

Hi,

The main issue that I don’t have a M1 Mac at my disposal, and neither GH Actions nor Azure Pipelines supports M1 VM-s right now, AFAIK. This makes building an M1 compatible wheel difficult, especially testing it.

After some messing around with this for a while I discovered that I was using a pyenv Python installation instead of the one installed with homebrew. After switching back to the Homebrew installed Python I was able to recompile/reinstall and things look proper and work correctly.

Thanks for all your work! Chris Wells