# Slow YOLOv8 inference speed in Jetson Orin Nano (had trouble with pytorch and torchvision installation)

**URL:** <https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735>\
**Category:** Jetson Orin Nano\
**Tags:** yolo, pytorch\
**Created:** [September 18, 2023, 8:23am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735 "2023-09-18T08:23:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arifiqbal3302](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@arifiqbal3302](https://forums.developer.nvidia.com/u/arifiqbal3302)\
**Post date:** [September 18, 2023, 8:23am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/1 "2023-09-18T08:23:54Z")

</div>

hello and greetings,

Right now I am working on yolov8 project for object detection, during inference I realize that instead of using GPU it was using the CPU instead, therefore the slow inference speed which is around ~300ms

setup :

- Hardware: NVIDIA Orin Nano 8GB
- Object Detection Model: YOLOv8
- Jetpack: 5.1.1

I was following this tutorial [Explains how to make YOLOv8 work with Jetson Nano | i7y blog](https://i7y.org/en/yolov8-on-jetson-nano/) and [https://docs.ultralytics.com/](https://docs.ultralytics.com/)

then i proceed with installation of pytorch and torchvision which then lead to error during torchvision installation which said :  
" error: bad install directory or PYTHONPATH  
You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read “.pth” files from. The installation directory you specified (via --install-dir, --prefix, or the disutils default setting) was :

/home/bizbot/.local/lib/python3.8/site-packages/

and your PYTHONPATH environment variable currently contains:  
‘’ "

---

<div class="post-metadata">

**Author:** ![arifiqbal3302](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@arifiqbal3302](https://forums.developer.nvidia.com/u/arifiqbal3302)\
**Post date:** [September 18, 2023, 8:52am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/3 "2023-09-18T08:52:32Z")

</div>

when i check my pytorch version using torch. **version** , it came out with "\>\> torch\> **version** ’2.0.0+nv23.05’ " and when im checking my torchvision using import torchvision, it shows error “/home/bizbot/ultralytics/venv/lib/python3.8/site-packages/torchvision/io/images.py:13: Userwarning: Failed to load image python extension: libcudart.so.10.2: cannot open shared object file:No such file or directory  
warn(f"Failed to load image Python extension: {e}”) "

i’ve tried reinstalling, reboot, create another environment using another version, but the error still persist

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [September 18, 2023, 9:02am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/4 "2023-09-18T09:02:35Z")

</div>

Hi,

The tutorial is for JetPack 4 which uses CUDA 10.2.  
But Orin Nano use JetPack 5 and CUDA 11.4.

Would you mind trying the below container (l4t-pytorch:r35.2.1-pth2.0-py3) to see if it can work on GPU?

> **[NVIDIA L4T PyTorch | NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-pytorch)**
>
> PyTorch is a GPU accelerated tensor computational framework with a Python front end. This container contains PyTorch and torchvision pre-installed in a Python 3 environment to get up & running quickly with PyTorch on Jetson.

Thanks.

---

<div class="post-metadata">

**Author:** ![arifiqbal3302](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@arifiqbal3302](https://forums.developer.nvidia.com/u/arifiqbal3302)\
**Post date:** [September 18, 2023, 10:18am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/6 "2023-09-18T10:18:50Z")

</div>

it still runs on CPU, I reinstall pytorch v2.0.0 and torchvision v0.15.1 and the error still persist during torchvision installation, the bad install directory error,

is there any specific installation method to specific path or something?

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [September 19, 2023, 6:07am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/7 "2023-09-19T06:07:21Z")

</div>

Hi,

Is the libcudart.so.10.2 error fixed?  
The “bad install directory” should be related to the way you install the package.

Thanks.

---

<div class="post-metadata">

**Author:** ![arifiqbal3302](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@arifiqbal3302](https://forums.developer.nvidia.com/u/arifiqbal3302)\
**Post date:** [September 19, 2023, 6:32am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/8 "2023-09-19T06:32:47Z")

</div>

yes , I reinstall it back again but outside of the virtual environment and it seems it fixed it

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 9, 2023, 5:01am UTC](https://forums.developer.nvidia.com/t/slow-yolov8-inference-speed-in-jetson-orin-nano-had-trouble-with-pytorch-and-torchvision-installation/266735/11 "2023-10-09T05:01:38Z")

</div>

Closed on October 9, 2023, 5:01am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
