Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I build pyuvc on Raspberry PI 3? #62

Open
davidchaozhang opened this issue May 23, 2019 · 7 comments
Open

Can I build pyuvc on Raspberry PI 3? #62

davidchaozhang opened this issue May 23, 2019 · 7 comments

Comments

@davidchaozhang
Copy link

Hi:

I tried the library quickly on a Raspberry PI, and I got the compilation failed. My initial impression is that the C compiler/libraries on Pi is not the same as the C compiler/library on Ubuntu, and it is much older.

Any idea of changes I can make to build the library on PI and that I can run 16-bit inputs from a camera?

Thanks,

David

@lukaszog
Copy link

What errors do you have?

@yurikleb
Copy link

yurikleb commented Mar 2, 2020

Hey,
I just manged to compile all the dependencies and install the library on a Raspberry Pi 4 (4GB version), running Raspbian Buster (v.10) following the instructions here

However you will need to install libusb beforehand: sudo apt-get install libusb-1.0
I also had OpenCV and CMake installed following the tutorial here

But when trying to run the example.py file I'm getting the following error:
Traceback (most recent call last): File "/home/pi/Downloads/pyuvc/example.py", line 2, in <module> import uvc ImportError: /usr/local/lib/libuvc.so.0: undefined symbol: libusb_handle_events_completed

**Update:
Following the suggestion on this issue It seems like Raspbian 10 already has pkg-config pre-installed, or it was installed during one of the updates prior to compiling and installing any of the pyuvc dependencies. as I got 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. response when running sudo apt-get install pkg-config

@yurikleb
Copy link

yurikleb commented Mar 24, 2020

Update!
Just managed to install pyuvc on a fresh setup of Raspbian Buster v.10 (2020-02-13 Release) on Raspberry Pi 4 (4gb) under Python 3.

Using the following commands:

Update Upgrade Debian OS and apt-get package manager:

sudo apt-get update && sudo apt-get upgrade  

Install CMake:
sudo apt-get install build-essential cmake unzip pkg-config

Install libusb 1.0-0-dev:
sudo apt-get install libusb-1.0-0-dev

Change to your Downloads directory:
cd ~/Downloads

Install Pupil-Labs version of libuvc:

git clone https://github.com/pupil-labs/libuvc  
cd libuvc/  
mkdir build  
cd build  
cmake ..  
make && sudo make install  
sudo ldconfig  

Go back to your Downloads Folder:
cd ~/Downloads

Install libjpeg-turbo:

wget -O libjpeg-turbo.tar.gz https://sourceforge.net/projects/libjpeg-turbo/files/1.5.1/libjpeg-turbo-1.5.1.tar.gz/download  
tar xvzf libjpeg-turbo.tar.gz  
cd libjpeg-turbo-1.5.1/  
./configure --with-pic --prefix=/usr/local  
sudo make install  
sudo ldconfig  

Install cython and numpy:

sudo pip3 install cython  
sudo pip3 install numpy  

Set UDEV rules:

echo 'SUBSYSTEM=="usb",  ENV{DEVTYPE}=="usb_device", GROUP="plugdev", MODE="0664"' | sudo tee /etc/udev/rules.d/10-libuvc.rules > /dev/null  
  
sudo udevadm trigger

Go back to your Downloads Folder:
cd ~/Downloads

Install pyucv:

git clone https://github.com/pupil-labs/pyuvc.git  
cd pyuvc/  
sudo python3 setup.py install  

Connect a USB camera to the Pi

Run the example file to confirm pyuvc was installed and works
python3 example.py

@yurikleb
Copy link

yurikleb commented Jun 10, 2020

Another Update!
The above instructions seem to work on Raspberry Pi3 as well.

papr pushed a commit that referenced this issue Sep 15, 2022
@kornpow
Copy link

kornpow commented Jan 30, 2024

I tried this today, and I wanted to report the latest build process on the RPi now that a number of years has gone by.

Im happy to report that I was able to get it installed using only apt and pip commands, and no manual compilation like some of the above messages.

sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libturbojpeg0-dev
pip install -vvv pupil-labs-uvc --timeout=60 --retries=10

As you can see I added some timeout extensions and retries. Pip really wanted to fail, but adding the verbosity helped me get through the problems. I probably ran the pip command about 3 times before I finally got it.

My hardware: Pi Zero 2W (Same CPU as Pi 3)
My Software: Raspbian Lite 64-bit

Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

@ErfolgreichCharismatisch

This thread is gold

@kornpow
Copy link

kornpow commented Feb 9, 2024

Hopefully gold in a good way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants