| # Installing libusb-1.0.so.0 Without sudo Access | |
| This guide provides step-by-step instructions to install `libusb-1.0.so.0` without requiring `sudo` access. | |
| ## **1️⃣ Check If libusb Is Installed** | |
| Run the following command to check if `libusb` is already installed: | |
| ```bash | |
| ls -l /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 | |
| ``` | |
| If the file exists, no installation is needed. Otherwise, follow the steps below. | |
| --- | |
| ## **2️⃣ Option 1: Install libusb Using Conda (Recommended)** | |
| If you have Anaconda or Miniconda installed, you can install `libusb` easily: | |
| ```bash | |
| conda install -c conda-forge libusb | |
| ``` | |
| This method does not require `sudo` access. | |
| --- | |
| ## **3️⃣ Option 2: Install libusb Locally (Without sudo)** | |
| ### **Step 1: Download libusb Source Code** | |
| ```bash | |
| wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 | |
| ``` | |
| *(Check for the latest version [here](https://github.com/libusb/libusb/releases))* | |
| ### **Step 2: Extract and Compile** | |
| ```bash | |
| tar -xvjf libusb-1.0.26.tar.bz2 | |
| cd libusb-1.0.26 | |
| ./configure --prefix=$HOME/libusb_install --disable-udev | |
| make -j$(nproc) | |
| make install | |
| ``` | |
| This installs `libusb` in your home directory (`~/libusb_install/`). | |
| ### **Step 3: Set Environment Variables** | |
| ```bash | |
| export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH | |
| export PKG_CONFIG_PATH=$HOME/libusb_install/lib/pkgconfig:$PKG_CONFIG_PATH | |
| export PATH=$HOME/libusb_install/bin:$PATH | |
| ``` | |
| To make these settings permanent, add them to `.bashrc`: | |
| ```bash | |
| echo 'export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH' >> ~/.bashrc | |
| echo 'export PKG_CONFIG_PATH=$HOME/libusb_install/lib/pkgconfig:$PKG_CONFIG_PATH' >> ~/.bashrc | |
| echo 'export PATH=$HOME/libusb_install/bin:$PATH' >> ~/.bashrc | |
| source ~/.bashrc | |
| ``` | |
| ### **Step 4: Verify Installation** | |
| Check if `libusb` is correctly installed: | |
| ```bash | |
| ls -l $HOME/libusb_install/lib/libusb-1.0.so.0 | |
| ``` | |
| --- | |
| ## **4️⃣ Option 3: Use Precompiled libusb (If Compilation Fails)** | |
| If you cannot compile `libusb`, try downloading a precompiled version: | |
| 1️⃣ Find a system where `libusb-1.0.so.0` exists: | |
| ```bash | |
| find /usr/lib /usr/local/lib -name "libusb-1.0.so.0" | |
| ``` | |
| 2️⃣ Copy it to your local system: | |
| ```bash | |
| cp /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 ~/libusb_install/lib/ | |
| ``` | |
| 3️⃣ Update the environment variable: | |
| ```bash | |
| export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH | |
| ``` | |
| --- | |
| ## **5️⃣ Test If libusb Works** | |
| Run: | |
| ```bash | |
| ldd $(which python) | grep libusb | |
| ``` | |
| If `libusb-1.0.so.0` is missing, force Python to use it: | |
| ```bash | |
| LD_PRELOAD=$HOME/libusb_install/lib/libusb-1.0.so.0 python -c "import tflite_model_maker" | |
| ``` | |
| --- | |
| ## **6️⃣ Final Check** | |
| Now, test your installation by running: | |
| ```bash | |
| python -c "import tflite_model_maker" | |
| ``` | |
| If no errors appear, `libusb` is successfully installed! 🚀 | |
| --- | |
| ### **💡 Summary** | |
| ✔ Installed `libusb` **without sudo** | |
| ✔ Disabled `udev` to avoid missing header issues | |
| ✔ Set up **environment variables** for Python to detect `libusb` | |
| ✔ Verified installation using `ldd` and `python` | |
| This should resolve your issue. If you encounter any problems, feel free to ask for help! 🚀 | |