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

PySpaceMouse on MacOS ARM M1 #10

Closed
JakubAndrysek opened this issue Mar 16, 2023 · 5 comments
Closed

PySpaceMouse on MacOS ARM M1 #10

JakubAndrysek opened this issue Mar 16, 2023 · 5 comments
Assignees

Comments

@JakubAndrysek
Copy link
Owner

I have tried to install PySpaceMouse on MacOS M1, but it doesn`t work.
Is there anybody who fixed this issue?

I have installed hidapi trough brew install hidapi.
My result from basicExample.py is there:

 ✘ kuba@KA-M1  ~/Documents/git/kuba/pyspacemouse   master ±  python3.11 ./examples/basicExample.py
Traceback (most recent call last):
  File "/Users/kuba/Documents/git/kuba/pyspacemouse/./examples/basicExample.py", line 4, in <module>
    success = pyspacemouse.open()
              ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyspacemouse/pyspacemouse.py", line 703, in open
    all_devices = list_devices()
                  ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyspacemouse/pyspacemouse.py", line 643, in list_devices
    hid = Enumeration()
          ^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/easyhid/easyhid.py", line 366, in __init__
    self.device_list = _hid_enumerate(vid, pid)
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/easyhid/easyhid.py", line 428, in _hid_enumerate
    start = hidapi.hid_enumerate(vendor_id, product_id)
            ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/cffi/api.py", line 912, in __getattr__
    make_accessor(name)
  File "/opt/homebrew/lib/python3.11/site-packages/cffi/api.py", line 908, in make_accessor
    accessors[name](name)
  File "/opt/homebrew/lib/python3.11/site-packages/cffi/api.py", line 838, in accessor_function
    value = backendlib.load_function(BType, name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: function/symbol 'hid_enumerate' not found in library '<None>': dlsym(RTLD_DEFAULT, hid_enumerate): symbol not found

Related links:

@misz11
Copy link

misz11 commented Mar 20, 2023

I recently had the same issue on my Macbook Pro Apple M1 (MacOS Ventura). The issue is that I installed my python environment with anaconda for x86_64 instead of arm M1.
Python runs without problem thanks to Rosetta. However, when python is loading library, it expects those library to be x86_64 as well. I found two ways to solve the issue:

  1. Reinstall anaconda by using the version for arm M1 (by default it downloads the x86_64 version, simply scroll all the way down the page to have the full list)
  2. Use a pre-compiled version of libhidapi.dylib for x86_64 by adding it to the PATH (here is the one I used:
    libhidapi.dylib.zip

@consi
Copy link
Contributor

consi commented Oct 18, 2023

Hey, I've managed to get it running by adding /opt/homebrew/Cellar/hidapi/0.14.0/lib to my DYLD_LIBRARY_PATH. (I run python with aarch64)

@JakubAndrysek
Copy link
Owner Author

Thanks, I will test it and your description in the main guide.

@JakubAndrysek
Copy link
Owner Author

Hey, I've managed to get it running by adding /opt/homebrew/Cellar/hidapi/0.14.0/lib to my DYLD_LIBRARY_PATH. (I run python with aarch64)

Thanks a lot for your solution. I have tested it, and everything works perfectly.
I have also added it to the primary documentation.

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

No branches or pull requests

3 participants