libusb-package is a Python library that functions primarily as an installation vehicle for the libusb shared C libraries, making it easier to install tools and applications that require libusb, such as pyusb. It bundles the necessary libusb binaries for various platforms and architectures, simplifying deployment by avoiding manual libusb installation. The package is actively maintained, with version 1.0.26.3 being the latest, and receives updates to support new Python versions and upstream libusb releases.
pip install libusb-packageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import `libusb_package` and use its `find_library` function to provide a backend for `pyusb`, allowing `pyusb` to utilize the libusb shared library bundled within `libusb-package`. It then attempts to find a generic USB device (replace with your actual Vendor/Product ID).
Upgrade your Python environment to 3.7 or newer.
Install the appropriate USB driver (e.g., WinUSB, libusbK) for your device using a tool like Zadig after installing `libusb-package`.
Ensure all necessary build dependencies (e.g., autoconf, automake, Visual Studio) are installed before attempting a source installation, or ensure a pre-built wheel is available for your platform and Python version.
Upgrade `libusb-package` to version 1.0.24.1 or newer, or ensure you are running Python 3.9+.
No user-facing fix is typically required unless custom code was deeply coupled with `libusb_package`'s internal resource handling. Ensure you are on the latest version for internal compatibility.
Ensure libusb-package is correctly installed via `pip install libusb-package`. If issues persist, explicitly configure PyUSB to use the backend provided by libusb-package by passing `backend=libusb_package.get_libusb1_backend()` to PyUSB functions like `usb.core.find()`.
Install the pyusb library using pip: `pip install pyusb`.
Reinstall `libusb-package` (`pip install libusb-package`) to ensure proper binary placement. On Windows, if automatic placement fails, manually copy the appropriate `libusb-1.0.dll` (from libusb's official binaries, matching your Python's architecture) to `C:\Windows\System32` (for 64-bit Python) or `C:\Windows\SysWOW64` (for 32-bit Python). On Linux, ensure the `libusb-1.0-0-dev` package (or equivalent for your distribution) is installed (e.g., `sudo apt-get install libusb-1.0-0-dev`).
Install the necessary build requirements for your operating system. For Linux and macOS, install `autoconf`, `automake`, `libtool`, and `m4`. For Windows, install Visual Studio 2019 (Community edition is sufficient). After installing these tools, retry `pip install libusb-package`.