JnyJny / blynclight

Python bindings for the Embrava BlyncLight family of products.
Apache License 2.0
21 stars 3 forks source link

ImportError: failed to locate suitable hidapi shared object #1

Closed bkcrisler closed 5 years ago

bkcrisler commented 6 years ago

Afternoon -

While trying to import Blynclight, I get the following Error:

`Python 3.7.0 (default, Aug 17 2018, 21:14:48) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information.

from blynclight import BlyncLight Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/blynclight/init.py", line 30, in from .blynclight import BlyncLight File "/usr/local/lib/python3.7/site-packages/blynclight/blynclight.py", line 6, in from .hid import enumerate as hid_enumerate File "/usr/local/lib/python3.7/site-packages/blynclight/hid/init.py", line 48, in raise ImportError('failed to locate suitable hidapi shared object') ImportError: failed to locate suitable hidapi shared object `

As you might know, I am running Mac OS X with Python3.7. Also, it doesn't say, but could you post the package dependencies required? I suspect that may be the issue.

JnyJny commented 6 years ago

I did forget a dependency and I'm not quite sure how to specify it wrt to the python packaging.

For macOS, I used brew to install hidapi:

  # brew install hidapi

and for CentOS/RedHat derived Linuxes I used:

  # yum -y install hidapi

That should at least get you started while I figure it out (pull requests accepted ;).

JnyJny commented 6 years ago

I think the right answer may be to switch from the HID API to PyUSB. Neither appear to be actively supported, however PyUSB has seen an update in the last year or so. I'll have to re-tool some of the USB communication in the implementation, but the API for the light should remain relatively stable.

PyUSB has a proper PyPi entry and appears to do the right thing on macOS and Linux.

JnyJny commented 6 years ago

I just pushed a set of changes that rips out HID API support in favor of PyUSB (which is listed as a requisite). It doesn't handle multiple devices opened simultaneously yet, but it seems to handle one just fine.

JnyJny commented 6 years ago

Installing in a clean virtual environment on both macOS and Linux results in a complete install of blynclight and it's pre-requisites. I've pushed a new package to PyPi with version 0.3.1 which should solve the issue (prerequisites not installed). @bkcrisler please let me know if this fixes the problem for you.

JnyJny commented 5 years ago

Sigh, I'm all alone. Closing this issue and crying myself to sleep.

bkcrisler commented 5 years ago

Sorry. I was able to update to the latest, but it doesn't recognize my Blynclight. Maybe the version I have is too old. I no longer have the import Blynclight issues though.

Bryan K. Crisler, Jr.
bkcrisler@gmail.com

On Mon, Sep 17, 2018 at 9:42 AM Erik OShaughnessy notifications@github.com wrote:

Closed #1 https://github.com/JnyJny/blynclight/issues/1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JnyJny/blynclight/issues/1#event-1849938400, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJvgQQG0zTJews_0BlKYKJPa4xzMzgaks5ub7TsgaJpZM4WiBbL .

JnyJny commented 5 years ago

Well that's a step in the right direction!

Can you post the output of 'system_profiler SPUSBDataType', it might help me identify your light.

JnyJny commented 5 years ago

I'm closing this issue since the original problem is fixed, opened a new issue to track the unrecognized light, #4 Light Not Recognized.