MattIPv4 / PyDMXControl

A Python 3 module to control DMX using OpenDMX or uDMX - Featuring fixture profiles, built-in effects and a web control panel.
https://pypi.org/project/PyDMXControl/
GNU General Public License v3.0
122 stars 23 forks source link

Fresh install, "No backend available" on OpenDMXController() instantiation #44

Closed austinwitherspoon closed 1 year ago

austinwitherspoon commented 1 year ago

Follows the instructions, pip installed via pip install -U PyDMXControl.

Tried to run the example code, but when I run dmx = OpenDMXController() I get the following exception:

>>> dmx = OpenDMXController()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python310\lib\site-packages\PyDMXControl\controllers\_OpenDMXController.py", line 27, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Python310\lib\site-packages\PyDMXControl\controllers\_TransmittingController.py", line 34, in __init__
    self.run()
  File "C:\Python310\lib\site-packages\PyDMXControl\controllers\_TransmittingController.py", line 92, in run
    self._connect()
  File "C:\Python310\lib\site-packages\PyDMXControl\controllers\_OpenDMXController.py", line 39, in _connect
    self.__ftdi.open(self.__ftdi_vendor_id, self.__ftdi_product_id, serial=self.__ftdi_serial)
  File "C:\Python310\lib\site-packages\pyftdi\ftdi.py", line 527, in open
    device = UsbTools.get_device(devdesc)
  File "C:\Python310\lib\site-packages\pyftdi\usbtools.py", line 175, in get_device
    devs = cls._find_devices(devdesc.vid, devdesc.pid)
  File "C:\Python310\lib\site-packages\pyftdi\usbtools.py", line 597, in _find_devices
    backend = cls._load_backend()
  File "C:\Python310\lib\site-packages\pyftdi\usbtools.py", line 663, in _load_backend
    raise ValueError('No backend available')
ValueError: No backend available

Running Windows 11, Python 3.10

MattIPv4 commented 1 year ago

Hey! What device are you using, and do you have the required drivers installed?

austinwitherspoon commented 1 year ago

Entec DMX USB Pro, and I believe so. QLC works fine with it.

MattIPv4 commented 1 year ago

Hm, I don't have access to a DMX Pro, so I can't say I've tested the library with it. Assuming it is OpenDMX compatible, perhaps you need to set a different vendor/product ID when you instantiate the controller?

https://github.com/MattIPv4/PyDMXControl/blob/27d41b33689eb197492a5928494a6d2f15ac391e/PyDMXControl/controllers/_OpenDMXController.py#L19-L21

ZotAlan commented 1 year ago

This is similar to an issue I had a couple of months ago. Python could see my controller but not talk to it.

My solution:

There could be a downside to updating your controller's WinUSB drivers. That is, my controller's OEM software is a little dated so after the driver update, the software no longer worked. That was okay for me since it's on a developer machine.

ZotAlan commented 1 year ago

My above solution worked on my Win10 Dell simple desktop PC. However, on my simple HP desktop PC, it's a no go. I'm back to the same error as above (no backend available). Help, please.

Traceback (most recent call last): File "C:\Users\Zot\Documents\Python\DMXPlay v3.py", line 17, in dmx = OpenDMXController() File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyDMXControl\controllers_OpenDMXController.py", line 27, in init super().init(*args, **kwargs) File "C:\Users\Scott\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyDMXControl\controllers_TransmittingController.py", line 34, in init self.run() File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyDMXControl\controllers_TransmittingController.py", line 92, in run self._connect() File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyDMXControl\controllers_OpenDMXController.py", line 39, in _connect self.ftdi.open(self.ftdi_vendor_id, self.ftdi_product_id, serial=self.ftdi_serial) File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyftdi\ftdi.py", line 527, in open device = UsbTools.get_device(devdesc) File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyftdi\usbtools.py", line 175, in get_device devs = cls._find_devices(devdesc.vid, devdesc.pid) File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyftdi\usbtools.py", line 597, in _find_devices backend = cls._load_backend() File "C:\Users\Zot\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyftdi\usbtools.py", line 663, in _load_backend raise ValueError('No backend available') ValueError: No backend available

Thomas-C258 commented 1 year ago

Ok so same problem here. Working with QLC+. I have a noname generic spot connected through a FTDI cable. I tried to change the vendor and product id, but did not help.

Any other idea?

Thomas-C258 commented 1 year ago

Going further:

I copied libusb-1.0.dll to windows/system32, and am able to confirm that my ftdi is detected through python with the right vendor and product id. No backend available has disappeared.

Now I get this:

dmx = OpenDMXController() File "C:\Python39\lib\site-packages\PyDMXControl\controllers_OpenDMXController.py", line 29, in init super().init(*args, kwargs) File "C:\Python39\lib\site-packages\PyDMXControl\controllers_TransmittingController.py", line 34, in init self.run() File "C:\Python39\lib\site-packages\PyDMXControl\controllers_TransmittingController.py", line 92, in run self._connect() File "C:\Python39\lib\site-packages\PyDMXControl\controllers_OpenDMXController.py", line 41, in _connect self.ftdi.open(self.ftdi_vendor_id, self.ftdi_product_id, serial=self.ftdi_serial) File "C:\Python39\lib\site-packages\pyftdi\ftdi.py", line 527, in open device = UsbTools.get_device(devdesc) File "C:\Python39\lib\site-packages\pyftdi\usbtools.py", line 191, in get_device config = dev.get_active_configuration() File "C:\Python39\lib\site-packages\usb\core.py", line 921, in get_active_configuration return self._ctx.get_active_configuration(self) File "C:\Python39\lib\site-packages\usb\core.py", line 113, in wrapper return f(self, *args, *kwargs) File "C:\Python39\lib\site-packages\usb\core.py", line 249, in get_active_configuration self.managed_open() File "C:\Python39\lib\site-packages\usb\core.py", line 113, in wrapper return f(self, args, kwargs) File "C:\Python39\lib\site-packages\usb\core.py", line 131, in managed_open self.handle = self.backend.open_device(self.dev) File "C:\Python39\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device return _DeviceHandle(dev) File "C:\Python39\lib\site-packages\usb\backend\libusb1.py", line 652, in init _check(_lib.libusb_open(self.devid, byref(self.handle))) File "C:\Python39\lib\site-packages\usb\backend\libusb1.py", line 600, in _check raise NotImplementedError(_strerror(ret)) NotImplementedError: Operation not supported or unimplemented on this platform

Thomas-C258 commented 1 year ago

And the solution, at last!

Using Zadig, I forced the install of the winusb driver instead of ftdibus, and it now works perfectly ! QLC+ doesn't work anymore, so you have to choose your drive depending on what you want to do !

ZotAlan commented 1 year ago

Thomas-C258 --

Thanks for sharing. I'm convinced my problem is also a driver issue. Last spring, had the same issue with a Dell but able to solve it with Zadig and replacing a USB driver. Unfortunately, that same solution didn't work for an HP so I'm really hoping what you found is the solution. It looks very promising.

ZotAlan

ZotAlan commented 1 year ago

Thomas-C258 --

I have success! The solution I found in April works on my Dell computer but not my HP. Your driver suggestion did not work on my HP, but you made me realize to think more broadly. I tried installing another driver (third effort), libusb-win32 (v1.2.7.3), which works on the HP.

The moral of the story, try different drivers. The caveat is be careful because installing other drivers may impact something else. Always take note of the current driver before installing another driver.

ZotAlan

MattIPv4 commented 1 year ago

Closing as this appears to be a local driver issue, not a library issue. Feel free to open a PR to add a note to the README with a summary of fixing driver issues if you wish :)