Nekshay commited on
Commit
22fd6e9
·
verified ·
1 Parent(s): 74f052c

Create readme.md

Browse files
Files changed (1) hide show
  1. readme.md +108 -0
readme.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing libusb-1.0.so.0 Without sudo Access
2
+
3
+ This guide provides step-by-step instructions to install `libusb-1.0.so.0` without requiring `sudo` access.
4
+
5
+ ## **1️⃣ Check If libusb Is Installed**
6
+ Run the following command to check if `libusb` is already installed:
7
+ ```bash
8
+ ls -l /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0
9
+ ```
10
+ If the file exists, no installation is needed. Otherwise, follow the steps below.
11
+
12
+ ---
13
+
14
+ ## **2️⃣ Option 1: Install libusb Using Conda (Recommended)**
15
+ If you have Anaconda or Miniconda installed, you can install `libusb` easily:
16
+ ```bash
17
+ conda install -c conda-forge libusb
18
+ ```
19
+ This method does not require `sudo` access.
20
+
21
+ ---
22
+
23
+ ## **3️⃣ Option 2: Install libusb Locally (Without sudo)**
24
+ ### **Step 1: Download libusb Source Code**
25
+ ```bash
26
+ wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2
27
+ ```
28
+ *(Check for the latest version [here](https://github.com/libusb/libusb/releases))*
29
+
30
+ ### **Step 2: Extract and Compile**
31
+ ```bash
32
+ tar -xvjf libusb-1.0.26.tar.bz2
33
+ cd libusb-1.0.26
34
+ ./configure --prefix=$HOME/libusb_install --disable-udev
35
+ make -j$(nproc)
36
+ make install
37
+ ```
38
+ This installs `libusb` in your home directory (`~/libusb_install/`).
39
+
40
+ ### **Step 3: Set Environment Variables**
41
+ ```bash
42
+ export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH
43
+ export PKG_CONFIG_PATH=$HOME/libusb_install/lib/pkgconfig:$PKG_CONFIG_PATH
44
+ export PATH=$HOME/libusb_install/bin:$PATH
45
+ ```
46
+ To make these settings permanent, add them to `.bashrc`:
47
+ ```bash
48
+ echo 'export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
49
+ echo 'export PKG_CONFIG_PATH=$HOME/libusb_install/lib/pkgconfig:$PKG_CONFIG_PATH' >> ~/.bashrc
50
+ echo 'export PATH=$HOME/libusb_install/bin:$PATH' >> ~/.bashrc
51
+ source ~/.bashrc
52
+ ```
53
+
54
+ ### **Step 4: Verify Installation**
55
+ Check if `libusb` is correctly installed:
56
+ ```bash
57
+ ls -l $HOME/libusb_install/lib/libusb-1.0.so.0
58
+ ```
59
+
60
+ ---
61
+
62
+ ## **4️⃣ Option 3: Use Precompiled libusb (If Compilation Fails)**
63
+ If you cannot compile `libusb`, try downloading a precompiled version:
64
+
65
+ 1️⃣ Find a system where `libusb-1.0.so.0` exists:
66
+ ```bash
67
+ find /usr/lib /usr/local/lib -name "libusb-1.0.so.0"
68
+ ```
69
+ 2️⃣ Copy it to your local system:
70
+ ```bash
71
+ cp /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 ~/libusb_install/lib/
72
+ ```
73
+ 3️⃣ Update the environment variable:
74
+ ```bash
75
+ export LD_LIBRARY_PATH=$HOME/libusb_install/lib:$LD_LIBRARY_PATH
76
+ ```
77
+
78
+ ---
79
+
80
+ ## **5️⃣ Test If libusb Works**
81
+ Run:
82
+ ```bash
83
+ ldd $(which python) | grep libusb
84
+ ```
85
+ If `libusb-1.0.so.0` is missing, force Python to use it:
86
+ ```bash
87
+ LD_PRELOAD=$HOME/libusb_install/lib/libusb-1.0.so.0 python -c "import tflite_model_maker"
88
+ ```
89
+
90
+ ---
91
+
92
+ ## **6️⃣ Final Check**
93
+ Now, test your installation by running:
94
+ ```bash
95
+ python -c "import tflite_model_maker"
96
+ ```
97
+ If no errors appear, `libusb` is successfully installed! 🚀
98
+
99
+ ---
100
+
101
+ ### **💡 Summary**
102
+ ✔ Installed `libusb` **without sudo**
103
+ ✔ Disabled `udev` to avoid missing header issues
104
+ ✔ Set up **environment variables** for Python to detect `libusb`
105
+ ✔ Verified installation using `ldd` and `python`
106
+
107
+ This should resolve your issue. If you encounter any problems, feel free to ask for help! 🚀
108
+