regcs / AliceLG

A Blender add-on for the use of Blender with the Looking Glass holographic displays.
GNU General Public License v3.0
103 stars 23 forks source link

Can't run addon in Blender 2.92 on Ubuntu 20.04 #39

Closed patriciogonzalezvivo closed 3 years ago

patriciogonzalezvivo commented 3 years ago

I get this error every time i try to enable the addon in Blender 2.92 in Ubuntu 20.04

Read prefs: /home/patricio/.config/blender/2.92/config/userpref.blend
Traceback (most recent call last):
  File "/usr/share/blender/2.92/scripts/modules/addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "/home/patricio/.config/blender/2.92/scripts/addons/AliceLG-beta7/__init__.py", line 66, in <module>
    from .operators import libHoloPlayCore
  File "/home/patricio/.config/blender/2.92/scripts/addons/AliceLG-beta7/operators/libHoloPlayCore.py", line 53, in <module>
    import hid as hidapi
  File "/home/patricio/.config/blender/2.92/scripts/addons/AliceLG-beta7/lib/hid/__init__.py", line 50, in <module>
    raise ImportError(error)
ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.0.dylib libhidapi.dylib hidapi.dll libhidapi-0.dll
regcs commented 3 years ago

Could you just try to install these libraries via APT? To do so, it should suffice to do the following on the console:

sudo apt update
sudo apt install libhidapi-libusb0

Then restart your computer and run Blender with Alice/LG again.

smirgol commented 3 years ago

I'm having the same issue, the required packages are installed. I was able to fix it for me by editing ~/.config/blender/2.93/scripts/addons/AliceLG-master/lib/hid/__init__.py (change the 2.93 to 2.92 for your blender version) and on the lines 10, 12, 14 removing the "lib" prefix and the ".so" suffix on hidraw, libusb and iohidmanager. So, for me it now reads:

library_names = (
    'hidapi-hidraw',
    'libhidapi-hidraw.so.0',
    'hidapi-libusb',
    'libhidapi-libusb.so.0',
    'hidapi-iohidmanager',
    'libhidapi-iohidmanager.so.0',
    'libhidapi.0.dylib',
    'libhidapi.dylib',
    'hidapi.dll',
    'libhidapi-0.dll'
)

I found this out by looking at the documentation for ctypes, which says that any "lib" prefix and ".so" suffix should be removed:

 name is the library name without any prefix like lib, suffix like .so, .dylib or version number

Hope this helps.

regcs commented 3 years ago

Thanks for pointing this out, @smirgol.

regcs commented 3 years ago

With Alice/LG 2.0 the hidapi library was removed, so the issue does not persist.