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

TypeError: expected string or bytes-like object #4857

Closed
alicera opened this issue Sep 19, 2021 · 5 comments · Fixed by #5592
Closed

TypeError: expected string or bytes-like object #4857

alicera opened this issue Sep 19, 2021 · 5 comments · Fixed by #5592
Labels
bug Something isn't working Stale

Comments

@alicera
Copy link

alicera commented Sep 19, 2021

ENV pytorch 21.08

python detect.py

Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf...
100%|█████████████████████████████████████████████████████████████████████████████| 755k/755k [00:00<00:00, 5.16MB/s]
Traceback (most recent call last):
File "yolov5/utils/plots.py", line 54, in check_font
return ImageFont.truetype(str(font) if font.exists() else font.name, size)
File "/opt/conda/lib/python3.8/site-packages/PIL/ImageFont.py", line 853, in truetype
return freetype(font)
File "/opt/conda/lib/python3.8/site-packages/PIL/ImageFont.py", line 850, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/opt/conda/lib/python3.8/site-packages/PIL/ImageFont.py", line 173, in init
freetype_version = parse_version(features.version_module("freetype2"))
File "/opt/conda/lib/python3.8/site-packages/packaging/version.py", line 49, in parse
return Version(version)
File "/opt/conda/lib/python3.8/site-packages/packaging/version.py", line 264, in init
match = self._regex.search(version)
TypeError: expected string or bytes-like object

During handling of the above exception, another exception occurred:

@alicera alicera added the bug Something isn't working label Sep 19, 2021
@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 19, 2021

@alicera 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible that still produces the same problem
  • Complete – Provide all parts someone else needs to reproduce your problem in the question itself
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem

In addition to the above requirements, for Ultralytics to provide assistance your code should be:

  • Current – Verify that your code is up-to-date with current GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been resolved by previous commits.
  • Unmodified – Your problem must be reproducible without any modifications to the codebase in this repository. Ultralytics does not provide support for custom code ⚠️.

If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template and providing a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

@alicera
Copy link
Author

alicera commented Sep 20, 2021

Reproducible
1.
https://github.com/ultralytics/yolov5/blob/master/Dockerfile
change to FROM nvcr.io/nvidia/pytorch:21.08-py3
2.

git clone https://github.com/ultralytics/yolov5/
cd yolov5
python detect.py

@glenn-jocher
Copy link
Member

@alicera as mentioned above we don't provide support for modified code.

If you run into an issue with the default repo though please let us know, thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2021

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@glenn-jocher
Copy link
Member

glenn-jocher commented Nov 10, 2021

@alicera good news 😃! Your original issue may now be fixed ✅ in PR #5592. This PR updates the Docker base image to 21.10 and also updates PIL, which was the root cause of this bug.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@glenn-jocher glenn-jocher linked a pull request Nov 10, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants