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

Jetsonnano + YOLOv5 could not work on python 3.6.9 #8

Closed
okome-git opened this issue May 16, 2021 · 16 comments
Closed

Jetsonnano + YOLOv5 could not work on python 3.6.9 #8

okome-git opened this issue May 16, 2021 · 16 comments

Comments

@okome-git
Copy link

Thanks for your useful repository!!
I met this type of error
"AssertionError: Python 3.7.0 required by YOLOv5, but Python 3.6.9 is currently installed"
How can I figure out ?

#I can read japanese.

@otamajakusi
Copy link
Owner

I think your jetpack should be updated to 4.5 or higher.
Try it!

@quicktwit
Copy link

quicktwit commented May 17, 2021

I had the similar issue. Try this comment: Run yolov5 on Jetson Nano

@okome-git
Copy link
Author

I updated to jetpack 4.5 today.
And, it didn't not work...
There was same issue
"AssertionError: Python 3.7.0 required by YOLOv5, but Python 3.6.9 is currently installed"

@otamajakusi
Copy link
Owner

Ok, I'd like to confirm this weekend.

@okome-git
Copy link
Author

Thanks !!

@otamajakusi
Copy link
Owner

recent commits at yolov5, ultralytics/yolov5#3088, requires python3.7 or higher.
I'd like to fix this issue. thanks.

@okome-git
Copy link
Author

Thank you for your kindness !

Do you know which commit of yolov5 is suitable for jetpack 4.5 ?

@otamajakusi
Copy link
Owner

@okome-git
before ultralytics/yolov5#3088, I think 91547edec1a33121b3607e8c946e051514182b4f can be used, like this:

diff --git a/Dockerfile b/Dockerfile
index 3b46f20..8dfe8e4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,5 +19,6 @@ RUN git clone --recursive https://github.com/skvark/opencv-python.git
 RUN python3 -m pip install --upgrade pip
 RUN cd opencv-python && python3 -m pip wheel . --verbose && find . -name "opencv_python*.whl" | xargs python3 -m pip install
 RUN git clone https://github.com/ultralytics/yolov5.git
+RUN git checkout 91547edec1a33121b3607e8c946e051514182b4f
 RUN cd yolov5 && python3 -m pip install -r requirements.txt
 WORKDIR /yolov5

@okome-git
Copy link
Author

It works !
Thank you!!

@phongvu0403
Copy link

Hello, I have same issue "AssertionError: Python 3.7.0 required by YOLOv5, but Python 3.6.9 is currently installed". I installed jetpack 4.5.1. In my Jetson Nano, Python version default is 3.6.9 then I installed Python 3.7.5 and I point python3 to python3.7. So when I type "python3 --version", terminal show "python 3.7.5". But this problem still exists.
Can you help me?
Thank advance

@otamajakusi
Copy link
Owner

Currently #8 (comment) is the only workaround for this issue.
Even if you install python3.7 on the docker environment, pytorch can not be worked.

@phongvu0403
Copy link

I think you should set cd yolov5 before git checkout 91547edec1a33121b3607e8c946e051514182b4f.

@okome-git
Copy link
Author

@phongvu0403
It works using "git checkout 91547edec1a33121b3607e8c946e051514182b4f".
But I could not use my custom training weights, because of "_pickle.UnpicklingError" like below,

Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='data/images', update=False, view_img=False, weights=['../yolov5_01/my_yolov5s.pt'])
YOLOv5 \U0001f680 v5.0-75-g91547ed torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3964.1328125MB)

Traceback (most recent call last):
File "detect.py", line 181, in
detect(opt=opt)
File "detect.py", line 33, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "/yolov5/models/experimental.py", line 120, in attempt_load
ckpt = torch.load(w, map_location=map_location) # load
File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 593, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 762, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '-'.

@phongvu0403
Copy link

@okome-git
I modified the Dockerfile following the author's instructions. However, there is 1 error here:

Step 15/18 : RUN git clone https://github.com/ultralytics/yolov5.git
---> Running in 0fd30920640d
Cloning into 'yolov5'...
Removing intermediate container 0fd30920640d
---> e70d45f62147
Step 16/18 : RUN git checkout 91547edec1a33121b3607e8c946e051514182b4f
---> Running in 08ab50a200dc
fatal: not a git repository (or any of the parent directories): .git
The command '/bin/sh -c git checkout 91547edec1a33121b3607e8c946e051514182b4f' returned a non-zero code: 128

Can you help me fixed this problem?
Thank you!

@otamajakusi
Copy link
Owner

otamajakusi commented May 27, 2021

workaround is add at c46325b
and default branch is changed to war-python36, since this is a workaround, not a solution.
please fetch and change your branch to war-python36.

@otamajakusi
Copy link
Owner

3c8e946 supports python3.8 and default branch has been changed to main.
In this commit, pre-build pytorch binary is used, which was build with https://github.com/otamajakusi/dockerfile-pytorch-build-jetson repo.
thanks.

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

4 participants