# Jupyter Labs cannot read from USB Webcam ("Getting Started with AI on Jetson Nano")

**URL:** <https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195>\
**Category:** Jetson Nano\
**Created:** [December 16, 2019, 4:34pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195 "2019-12-16T16:34:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 16, 2019, 4:34pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/1 "2019-12-16T16:34:40Z")

</div>

I am trying to get my USB Logitech Brio 4K webcam working in the “Getting Started with AI on Jetson Nano” course but am having problems. Here is the output:

Create the camera object¶

First, create a camera object by importing the USBCamera class from the library by executing the following Python code cell. Please note, you can only create one USBCamera instance. Set the capture\_device= to the correct number found when you listed the system video devices. If you have /dev/video0, then set capture\_device=0. If you have /dev/video1, set capture\_device=1 in the code line below.

```auto
from jetcam.usb_camera import USBCamera

​

#TODO change capture_device if incorrect for your system

camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__ (self, *args, **kwargs)
     23 if not re:
---> 24 raise RuntimeError('Could not read image from camera.')
     25 

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)
<ipython-input-7-5a6744da9a88> in <module>
      2 
      3 #TODO change capture_device if incorrect for your system
----> 4 camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)

/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__ (self, *args, **kwargs)
     26 except:
     27 raise RuntimeError(
---> 28 'Could not initialize camera. Please see error trace.')
     29 
     30 atexit.register(self.cap.release)

RuntimeError: Could not initialize camera. Please see error trace.

```

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 16, 2019, 4:35pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/2 "2019-12-16T16:35:07Z")

</div>

Anyone having the same problems?

Thanks

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 17, 2019, 6:58pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/3 "2019-12-17T18:58:06Z")

</div>

Partially fixed this I think by installing anything mjpeg, USB UVC, or VLC related. This gets me an image in VLC.

It does not allow me to run the example though, and I get the same error as above.

---

<div class="post-metadata">

**Author:** ![KratosAurion](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@KratosAurion](https://forums.developer.nvidia.com/u/KratosAurion)\
**Post date:** [December 18, 2019, 11:38am UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/4 "2019-12-18T11:38:32Z")

</div>

Following [RuntimeError: Could not initialize camera · Issue #12 · NVIDIA-AI-IOT/jetcam · GitHub](https://github.com/NVIDIA-AI-IOT/jetcam/issues/12) fixed the issue for me.

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 18, 2019, 12:53pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/5 "2019-12-18T12:53:00Z")

</div>

> [@](#):
>
> Following [RuntimeError: Could not initialize camera · Issue #12 · NVIDIA-AI-IOT/jetcam · GitHub](https://github.com/NVIDIA-AI-IOT/jetcam/issues/12) fixed the issue for me.

Thanks, but where is the usb\_camera.py file? I do not have it on my system!

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 18, 2019, 1:00pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/6 "2019-12-18T13:00:31Z")

</div>

To clarify, the local Jupyter webpage is specifying this file:  
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb\_camera.py

However, I only have this binary file present:  
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 18, 2019, 1:52pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/7 "2019-12-18T13:52:15Z")

</div>

Okay, I unzipped the .egg file (it is just a zip), made the edit to usb\_camera.py, copied it back to its place in usr.

But now I see this error:

```auto
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-fd9b9853e718> in <module>
----> 1 from jetcam.usb_camera import USBCamera
      2 
      3 #TODO change capture_device if incorrect for your system
      4 camera = USBCamera(width=4096, height=2160, capture_device=0)

ModuleNotFoundError: No module named 'jetcam'

```

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [December 18, 2019, 2:03pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/8 "2019-12-18T14:03:18Z")

</div>

I had to do this:

git clone [GitHub - NVIDIA-AI-IOT/jetcam: Easy to use Python camera interface for NVIDIA Jetson](https://github.com/NVIDIA-AI-IOT/jetcam)  
cd jetcam  
pip3 install ./ --user

And now it works. Yay.

---

<div class="post-metadata">

**Author:** ![nicolas.lechanu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nicolas.lechanu](https://forums.developer.nvidia.com/u/nicolas.lechanu)\
**Post date:** [March 23, 2020, 10:27am UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/9 "2020-03-23T10:27:24Z")

</div>

Hi jetsonnvidia,

I have been encountering the same problem as you have, and am currently trying to unzip the py3.6.egg file. I’m having a hard time doing this as I have the following permission error:

PermissionError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.6/dist-packages/EGG-INFO’

How were you able to unzip the file?

Thanks!

---

<div class="post-metadata">

**Author:** ![jetsonnvidia](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jetsonnvidia](https://forums.developer.nvidia.com/u/jetsonnvidia)\
**Post date:** [April 2, 2020, 2:55pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/10 "2020-04-02T14:55:17Z")

</div>

Try doing it as root.

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 14, 2021, 10:01pm UTC](https://forums.developer.nvidia.com/t/jupyter-labs-cannot-read-from-usb-webcam-getting-started-with-ai-on-jetson-nano/109195/11 "2021-10-14T22:01:59Z")

</div>

Closed on October 14, 2021, 10:01pm UTC


