Skip to content

Global dependency on ftd2xx.dll #109

@Steffen-Zienert

Description

@Steffen-Zienert

I installed Pylablib Version 1.4.3 on Win10 with Python 3.13.5 and get the following error when importing:

error message
In [1]: import pylablib

FileNotFoundError                         Traceback (most recent call last)
File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:461, in LibraryLoader.__getattr__(self, name)
    460 try:
--> 461     dll = self._dlltype(name)
    462 except OSError:

File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:390, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    389 if handle is None:
--> 390     self._handle = _dlopen(self._name, mode)
    391 else:

FileNotFoundError: Could not find module 'ftd2xx' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
File ~\Downloads\WPy64-31350\python\Lib\site-packages\ft232\d2xx.py:29
     28 try:
---> 29     d2xx = c.windll.ftd2xx
     30 except AttributeError:

File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:463, in LibraryLoader.__getattr__(self, name)
    462 except OSError:
--> 463     raise AttributeError(name)
    464 setattr(self, name, dll)

AttributeError: ftd2xx

During handling of the above exception, another exception occurred:

FileNotFoundError                         Traceback (most recent call last)
File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:461, in LibraryLoader.__getattr__(self, name)
    460 try:
--> 461     dll = self._dlltype(name)
    462 except OSError:

File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:390, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    389 if handle is None:
--> 390     self._handle = _dlopen(self._name, mode)
    391 else:

FileNotFoundError: Could not find module 'ftd2xx' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pylablib

File ~\Downloads\WPy64-31350\python\Lib\site-packages\pylablib\__init__.py:9
      6 temp_par=library_parameters.temp_library_parameters
      8 from .core.dataproc.__export__ import *
----> 9 from .core.devio.__export__ import *
     10 from .core.fileio.__export__ import *
     11 from .core.gui.__export__ import *

File ~\Downloads\WPy64-31350\python\Lib\site-packages\pylablib\core\devio\__export__.py:3
      1 # pylint: disable-all
      2 from .base import DeviceError
----> 3 from .comm_backend import list_backend_resources, new_backend, DeviceBackendError
      4 from .interface import IDevice, EnumParameterClass, RangeParameterClass, use_parameters
      5 from .SCPI import SCPIDevice

File ~\Downloads\WPy64-31350\python\Lib\site-packages\pylablib\core\devio\comm_backend.py:761
    755 _backend_errors["serial"]=_backend_install_message.format(name="PySerial",pkg="pyserial",mod="serial")
    760 try:
--> 761     import ft232
    763     class DeviceFT232Error(DeviceBackendError):
    764         """FT232 backend operation error"""

File ~\Downloads\WPy64-31350\python\Lib\site-packages\ft232\__init__.py:19
      1 #
      2 # Author: Logan Gunthorpe <[email protected]>
      3 # Copyright (c) Deltatee Enterprises Ltd. 2015, All rights reserved.
   (...)
     15 # You should have received a copy of the GNU Lesser General Public
     16 # License along with this library.
     18 try:
---> 19     from .d2xx import list_devices
     20     from .d2xx import D2xx as Ft232    
     21     from .d2xx import D2XXException as Ft232Exception

File ~\Downloads\WPy64-31350\python\Lib\site-packages\ft232\d2xx.py:31
     29         d2xx = c.windll.ftd2xx
     30     except AttributeError:
---> 31         d2xx = c.cdll.ftd2xx
     32 elif platform.system().startswith("Linux"):
     33     d2xx = c.cdll.LoadLibrary("libftd2xx.so")

File ~\Downloads\WPy64-31350\python\Lib\ctypes\__init__.py:463, in LibraryLoader.__getattr__(self, name)
    461     dll = self._dlltype(name)
    462 except OSError:
--> 463     raise AttributeError(name)
    464 setattr(self, name, dll)
    465 return dll

AttributeError: ftd2xx

I think this global dependency to the ftd2xx.dll-file is not intended. I can solve this by manually installing the file as detailed in the documentation:
https://pylablib.readthedocs.io/en/stable/devices/Thorlabs_kinesis.html

It also happens if I just import some other device (from pylablib.devices import Sirah).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions