Windows: libftdi library not found

Issue #19 closed
Anonymous created an issue

I've installed libftdi and other necessary files in Windows 7. This is working:

import ftdi1 as ftdi

context = ftdi.new()
ftdi.usb_open(context, 0x0403, 0x6001)
print('chip ID: %X\n' % ftdi.read_chipid(context)[1])

This gives the chip ID:

C:\Python33>python ftdi_test.py
chip ID: 231A7D5

When I try the installation test of your package I get:

C:\Python33>python -m pylibftdi.examples.led_flash
Traceback (most recent call last):
  File "C:\Python33\lib\runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python33\lib\runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "C:\Python33\lib\site-packages\pylibftdi\examples\led_flash.py", line 34, in <module>
    main()
  File "C:\Python33\lib\site-packages\pylibftdi\examples\led_flash.py", line 30, in main
    flash_forever(1)
  File "C:\Python33\lib\site-packages\pylibftdi\examples\led_flash.py", line 19, in flash_forever
    with BitBangDevice() as bb:
  File "C:\Python33\lib\site-packages\pylibftdi\bitbang.py", line 50, in __init__
    **kwargs)
  File "C:\Python33\lib\site-packages\pylibftdi\device.py", line 66, in __init__
    self.driver = Driver(**kwargs)
  File "C:\Python33\lib\site-packages\pylibftdi\driver.py", line 76, in __init__
    self._libftdi_path = self._find_libftdi(libftdi_search)
  File "C:\Python33\lib\site-packages\pylibftdi\driver.py", line 105, in _find_libftdi
    raise FtdiError('libftdi library not found (search: {})'.format(search_list))
pylibftdi._base.FtdiError: libftdi library not found (search: ('ftdi1', 'libftdi1', 'ftdi', 'libftdi'))

Am I doing something wrong or is Windows not supported.

Comments (11)

  1. Ben Bass repo owner
    • changed status to open

    OK, I've got hold of a Windows laptop and replicated this. Seems that find_library isn't great on Windows (works fine for kernel32, but fails for libftdi1 even if DLL is in the same directory), and passing the argument which would normally go to find_library direct to ctypes.CDLL can work, so I'll make the library detection a bit more sophisticated.

    I wonder if this is relevant: https://bugs.python.org/issue16283

  2. U P

    Hi Ben, The issue is not resolved even with the pylibftdi 0.15.0. I am using Python 2.7.10 and has issues in opening COM port to send commands to my device. C:\Python27>pip list asciitable (0.8.0) functools32 (3.2.3.post2) Jinja2 (2.8) JsonForm (0.0.2) jsonschema (2.5.1) JsonSir (0.0.2) MarkupSafe (0.23) pip (7.1.2) prettytable (0.7.2) pyftdi (0.6.3) pylibftdi (0.15.0) pyparsing (2.0.3) pyserial (2.7) python-dateutil (2.4.2) Python-EasyConfig (0.1.5) pytz (2015.6) pyusb (1.0.0b2) PyYAML (3.11) Resource (0.2.0) setuptools (16.0) six (1.9.0) texttable (0.8.3) Werkzeug (0.10.4) wheel (0.26.0)

    C:\Python27>python -m pylibftdi.examples.list_devices Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "C:\Python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\lib\site-packages\pylibftdi\examples\list_devices.py", line 42, in <module> for device in get_ftdi_device_list(): File "C:\Python27\lib\site-packages\pylibftdi\examples\list_devices.py", line 33, in get_ftdi_device_list for device in Driver().list_devices(): File "C:\Python27\lib\site-packages\pylibftdi\driver.py", line 211, in list_devices if self.fdll.ftdi_init(byref(ctx)) != 0: File "C:\Python27\lib\site-packages\pylibftdi\driver.py", line 159, in fdll self._fdll = self._load_library('libftdi') File "C:\Python27\lib\site-packages\pylibftdi\driver.py", line 125, in _load_library name, search_list)) pylibftdi._base.LibraryMissingError: libftdi library not found (search: ('ftdi1', 'libftdi1', 'ftdi', 'libftdi'))

  3. U P

    The issue is seen on both Python 2.7.10 (64-bit) on Windows 7 and Windows Server 2016 and Python 3.5.0 (64-bit) on Windows 7 OS: pylibftdi._base.LibraryMissingError: libftdi library not found (search: ('ftdi1', 'libftdi1', 'ftdi', 'libftdi'))

  4. Ben Bass repo owner

    Hello, how have you installed libftdi and libusb on your system?

    I don’t have ready access to a Windows setup at the moment, so it will take a few days (at least) for me to make much progress here, but checking that libftdi and libusb are properly installed is the starting place. Can any other software use the FTDI devices, and if so what FTDI driver are they using?

    Ben

  5. U P

    Hi Ben, I have installed the LibUSB1 python package. However, I can't find the LibFTDI python setup.py package. The only available one seems to be an Windows OS driver written by you. Thank you.

  6. Henk van de Kamer

    This (sorry in Dutch, but may be Google translate will help) was my procedure for installing all necessary files. You need libftdi1.dll, libusb-1.0.dll and tell Windows that it musn't use the standard FTDI driver *the Zadig-program). Both DLL's are compiled programs written in C. Hope this clarifies the parts needed and what you have to search for.

  7. ash87

    Hi, I've installed libftdi and other necessary files in Windows 10. This is working: from pylibftdi import Driver, Device

    Get list of all FTDI devices

    dev_list = Driver().list_devices()

    Print all devices

    for device_ in dev_list: print device_

    -- I am able to see the device listed ('XYZ', 'USB Adapter', 'ABC12345')

    But the moment i try to open the device, it throws out an error dev = Device(device_id='ABC12345', mode='b', interface_select=2)

    " pylibftdi._base.FtdiError : device not found (-3) "

    My basic intention is to use the FT2232 to talk to an I2C sensor. I am trying to use pylibftdi to control the FTDI.

    I noticed a lot of threads where the VCOM driver does not allow libftdi to get hold of the usb. can this be alleviated?

    I am new to this, so please bear my ignorance.

    Thanks

  8. Log in to comment