File size: 3,181 Bytes
22fd6e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# 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! 🚀