You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I saw people back in Sep 2020 able to use python3.6 and torch 1.6 to run YOLOv5 on Jetpack(Linux18.04). I have issues in installing torch 1.7 to Jetpack with python3.8. I wonder if I can use two other ways:
use an older version of YOLOv5 with python3.6+torch1.7, which I have successfully installed but failed the YOLOv5 requirements installation.
try another combination - torch1.8 and python3.8 as someone claimed a success.
Does anyone know if it is possible to get an older version of YOLOv5 or prove that torch1.8 works? Thanks!
@sammilei
On my Jetson Xavier NX, I am successfully running YOLOv5 with python 3.6.9 + torch 1.7, by manually installing the required packages.
Doing so required manual building of OpenCV, PyTorch, and the rest of the pip packages.
Before you follow anything I did below, you must get a fresh reinstall of JetPack 4.4.1 which has Python 3.6.9. I tried using virtual environments for python versions but that was fruitless.
Finally, for all the other requirements (Cython, matplotlib, Pillow, PyYAML, scipy, tensorboard, tqdm, seaborn, pandas), I simply got them with 'pip3 install ...'. For almost all of them, pre-built binaries were not available, so it took a very long time. Each one took something like 30 minutes.
I did not have success in getting anything to work with python 3.8, or any other version.
@triangularsalt Thanks a lot for your comment! I did try Jetpack 4.4.1(Python 3.6) + Pytorch 1.7 installed manually then I failed to install YOLOv5. So then I went with trials with Python 3.8. Probably I didn't build the OpenCV beforehand. I will try your approach with a fresh Jetpack 4.4.1. I will give updates later.
Thanks to @neuroquantifier's instruction, I was able to install OpenCV and torch and most of the dependencies. I am able to import torch with the built-in python3.6:
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
->>> import torch
->>> print(torch.version)
1.7.0
An issue occurs during the installation of torchvision as
running egg_info
creating pip-egg-info/torch.egg-info
writing pip-egg-info/torch.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/torch.egg-info/dependency_links.txt
writing requirements to pip-egg-info/torch.egg-info/requires.txt
writing top-level names to pip-egg-info/torch.egg-info/top_level.txt
writing manifest file 'pip-egg-info/torch.egg-info/SOURCES.txt'
error: package directory 'torch/cuda' does not exist
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6eg7m99c/torch/
@neuroquantifier how did you install thop? This is the final thing I cant manage to install and I am getting errors when running detect.py without it. If I do pip3 install thop I get an error
Could not find a version that satisfies the requirement torch>=1.0.0
I can't seem to install thop from source either as I get an error saying 'torch/cuda' directory doesn't exist.
@Ownmarc Ah, thank you so much! I also had to remove the OpenCV requirement and change the torchvision requirement to get past this check, everything is running now. Thanks so much for the help.
@Ownmarc@ttocs167 I've opened a PR #2041 for excluding packages from the requirements check. It's unclear to me which packages to add to the default list however.
Another option is to comment the check in detect.py altogether, under the assumption detect.py is more commonly used in deployed environments like jetpack.
@glenn-jocher Jetpack/Jetsons are a bit tricky, I would assume people playing with it to be able to play with the code and the requirement file.
I would simply make the requirement check a little more flexible so it can adapt to where its called in the code (detect vs train vs test). Having a lightweight deployment environment is key (nothing more then what's required to do the detections and serving the model) when we want to deploy in prod, the train/test environment can be a little more messy because we often change things there. Pycocotools and thop should be considered like the tensorboard and W&B requirements.. nice to have but not hard requirements
@Ownmarc PR #2571 now excludes pycocotools and thop from detect.py check_requirements() per your recommendation, and also based on user feedback from #2556.
I'm trying to install YOLOV5 on Python 3.6 for use on a Jetson Nano. I can't use a different Python version because I need PyTorch with support for CUDA 10.2 which only works with Python 3.6 because of Jetpack 4. I followed @tensorturtle instructions in regards to installing OpenCV with CUDA and a version of PyTorch with CUDA, but I can not get a version of Ultralytics to install for Python 3.6. I've followed the Ultralytics installation guide to clone the repo and pip install the requirements.txt file. It will all finish successfully. I've even tried checking out version 3.0 and repeating the installation, but I keep getting the error: ModuleNotFoundError: No module named 'ultralytics'. Any help would be much appreciated.
The ModuleNotFoundError: No module named 'ultralytics' error message usually implies a package installation issue. You might want to check if the ultralytics package was installed successfully after running pip install -U -r requirements.txt.
If the package is still not found, please try running pip install -U . in the YOLOv5 directory, which should install the local package.
Please let us know if this helps resolve the issue or if you need further assistance.
Thank you for your response! I git checked out v3.0 and ran those commands with pip3 (python 3.6) and it will go through all the requirements and say that they are satisfied, but when I try to open a python3.6 shell and import ultralytics it will say the module is not found. However, if I pip install with python3.8 (python3.8 -m pip install -U -r requirements.txt) everything works...but unfortunately I can't use python3.8 with the version of torch that uses CUDA on my nano :(. So I need to have Ultralytics run on Python 3.6. I know it isn't officially supported but a workaround would be awesome. Cheers
It's great to hear that the pip install -U -r requirements.txt command works with Python 3.8, but I understand that you need to use Python 3.6 with the version of torch that uses CUDA on your Nano.
As you mentioned, YOLOv5 is not officially supported on Python 3.6, but there may be a workaround that you can try. One possible solution is to try building the ultralytics package from source using Python 3.6 and the corresponding version of torch that you need. This process is described in the YOLOv5 README under the "Local install" section.
Alternatively, you could try creating a Python 3.6 virtual environment and installing all of the requirements there. This should ensure that all of the packages are installed with the correct version of Python.
I hope these suggestions are helpful! Let us know if you have any further questions or concerns.
Unfortunately running in a virtual environment didn't seem to change anything :(. I'd like to try building the package, but I can't seem to find where that is in the README. Would you mind pointing it out to me? Thank you. EDIT: Nevermind, I think I found the instructions in the ultralytics repo
@0marA I'm sorry to hear that creating a virtual environment did not work. Regarding building the ultralytics package from source, the instructions are provided in the YOLOv5 README under the "Local install" section. If you encounter any issues during the build process, please don't hesitate to ask for assistance. We're here to help!
Activity
glenn-jocher commentedon Jan 15, 2021
@sammilei you can access any release of YOLOv5 very easily:
git clone https://github.com/ultralytics/yolov5 cd yolov5 git checkout v3.0tensorturtle commentedon Jan 16, 2021
@sammilei
On my Jetson Xavier NX, I am successfully running YOLOv5 with python 3.6.9 + torch 1.7, by manually installing the required packages.
Doing so required manual building of OpenCV, PyTorch, and the rest of the pip packages.
Before you follow anything I did below, you must get a fresh reinstall of JetPack 4.4.1 which has Python 3.6.9. I tried using virtual environments for python versions but that was fruitless.
First, to build OpenCV, this guide worked. JetPack ships with a version of OpenCV, but it is not CUDA-enabled and is an older version, so it's better to rebuild.
https://qengineering.eu/install-opencv-4.5-on-jetson-nano.html
Next, for PyTorch I followed NVIDIA's guide
https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-7-0-now-available/72048
Finally, for all the other requirements (Cython, matplotlib, Pillow, PyYAML, scipy, tensorboard, tqdm, seaborn, pandas), I simply got them with 'pip3 install ...'. For almost all of them, pre-built binaries were not available, so it took a very long time. Each one took something like 30 minutes.
I did not have success in getting anything to work with python 3.8, or any other version.
My Jetson Xavier NX info

sammilei commentedon Jan 17, 2021
@triangularsalt Thanks a lot for your comment! I did try Jetpack 4.4.1(Python 3.6) + Pytorch 1.7 installed manually then I failed to install YOLOv5. So then I went with trials with Python 3.8. Probably I didn't build the OpenCV beforehand. I will try your approach with a fresh Jetpack 4.4.1. I will give updates later.
sammilei commentedon Jan 20, 2021
Thanks to @neuroquantifier's instruction, I was able to install
OpenCVandtorchand most of the dependencies. I am able to import torch with the built-in python3.6:Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
->>> import torch
->>> print(torch.version)
1.7.0
An issue occurs during the installation of
torchvisionasRunning
python3 detect.py --source inference/images/bus.jpg --weights yolov5s.pt --img 640requirestorchvision.How did you install torchvision? @neuroquantifier? Thanks in advance!
sammilei commentedon Jan 20, 2021
@neuroquantifier nvm. I installed
torchvisionthrough the same link for torch installation for Jetpack. The YOLOv5 works! I appreciate your help!ttocs167 commentedon Jan 25, 2021
@neuroquantifier how did you install thop? This is the final thing I cant manage to install and I am getting errors when running detect.py without it. If I do
pip3 install thopI get an errorCould not find a version that satisfies the requirement torch>=1.0.0I can't seem to install thop from source either as I get an error saying 'torch/cuda' directory doesn't exist.
Ownmarc commentedon Jan 25, 2021
@ttocs167 thop is optional requirement.. remove it from requirements.txt and you’ll be good.
ttocs167 commentedon Jan 25, 2021
@Ownmarc Ah, thank you so much! I also had to remove the OpenCV requirement and change the torchvision requirement to get past this check, everything is running now. Thanks so much for the help.
glenn-jocher commentedon Jan 25, 2021
@Ownmarc @ttocs167 I've opened a PR #2041 for excluding packages from the requirements check. It's unclear to me which packages to add to the default list however.
Another option is to comment the check in detect.py altogether, under the assumption detect.py is more commonly used in deployed environments like jetpack.
Ownmarc commentedon Jan 26, 2021
@glenn-jocher Jetpack/Jetsons are a bit tricky, I would assume people playing with it to be able to play with the code and the requirement file.
I would simply make the requirement check a little more flexible so it can adapt to where its called in the code (detect vs train vs test). Having a lightweight deployment environment is key (nothing more then what's required to do the detections and serving the model) when we want to deploy in prod, the train/test environment can be a little more messy because we often change things there. Pycocotools and thop should be considered like the tensorboard and W&B requirements.. nice to have but not hard requirements
3 remaining items
glenn-jocher commentedon Mar 23, 2021
@Ownmarc PR #2571 now excludes
pycocotoolsandthopfrom detect.pycheck_requirements()per your recommendation, and also based on user feedback from #2556.check_requirements() exclude pycocotools, thop (#2571)
check_requirements() exclude pycocotools, thop (ultralytics#2571)
pull updates from original repo (release v5) + reimplement UI (#21)
check_requirements() exclude pycocotools, thop (ultralytics#2571)
check_requirements() exclude pycocotools, thop (ultralytics#2571)
check_requirements() exclude pycocotools, thop (#2571)
0marA commentedon Jun 1, 2023
I'm trying to install YOLOV5 on Python 3.6 for use on a Jetson Nano. I can't use a different Python version because I need PyTorch with support for CUDA 10.2 which only works with Python 3.6 because of Jetpack 4. I followed @tensorturtle instructions in regards to installing OpenCV with CUDA and a version of PyTorch with CUDA, but I can not get a version of Ultralytics to install for Python 3.6. I've followed the Ultralytics installation guide to clone the repo and pip install the requirements.txt file. It will all finish successfully. I've even tried checking out version 3.0 and repeating the installation, but I keep getting the error: ModuleNotFoundError: No module named 'ultralytics'. Any help would be much appreciated.
glenn-jocher commentedon Jun 2, 2023
@0marA hi there!
The
ModuleNotFoundError: No module named 'ultralytics'error message usually implies a package installation issue. You might want to check if theultralyticspackage was installed successfully after runningpip install -U -r requirements.txt.If the package is still not found, please try running
pip install -U .in the YOLOv5 directory, which should install the local package.Please let us know if this helps resolve the issue or if you need further assistance.
0marA commentedon Jun 3, 2023
Thank you for your response! I git checked out v3.0 and ran those commands with pip3 (python 3.6) and it will go through all the requirements and say that they are satisfied, but when I try to open a python3.6 shell and import ultralytics it will say the module is not found. However, if I pip install with python3.8 (python3.8 -m pip install -U -r requirements.txt) everything works...but unfortunately I can't use python3.8 with the version of torch that uses CUDA on my nano :(. So I need to have Ultralytics run on Python 3.6. I know it isn't officially supported but a workaround would be awesome. Cheers
glenn-jocher commentedon Jun 4, 2023
@0marA hi there!
It's great to hear that the
pip install -U -r requirements.txtcommand works with Python 3.8, but I understand that you need to use Python 3.6 with the version of torch that uses CUDA on your Nano.As you mentioned, YOLOv5 is not officially supported on Python 3.6, but there may be a workaround that you can try. One possible solution is to try building the
ultralyticspackage from source using Python 3.6 and the corresponding version oftorchthat you need. This process is described in the YOLOv5 README under the "Local install" section.Alternatively, you could try creating a Python 3.6 virtual environment and installing all of the requirements there. This should ensure that all of the packages are installed with the correct version of Python.
I hope these suggestions are helpful! Let us know if you have any further questions or concerns.
0marA commentedon Jun 4, 2023
Unfortunately running in a virtual environment didn't seem to change anything :(. I'd like to try building the package, but I can't seem to find where that is in the README. Would you mind pointing it out to me? Thank you. EDIT: Nevermind, I think I found the instructions in the ultralytics repo
glenn-jocher commentedon Jun 4, 2023
@0marA I'm sorry to hear that creating a virtual environment did not work. Regarding building the
ultralyticspackage from source, the instructions are provided in the YOLOv5 README under the "Local install" section. If you encounter any issues during the build process, please don't hesitate to ask for assistance. We're here to help!check_requirements() exclude pycocotools, thop (#2571)