yolov5 icon indicating copy to clipboard operation
yolov5 copied to clipboard

为什么mac会抛出这个问题

Open sj746 opened this issue 1 year ago • 8 comments

Search before asking

  • [X] I have searched the YOLOv5 issues and discussions and found no similar questions.

Question

上传截屏2024-12-13 14.30.25.png...ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

Additional

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

sj746 avatar Dec 13 '24 06:12 sj746

👋 Hello @sj746, thank you for your interest in YOLOv5 🚀!

It seems like you are encountering a certificate verification issue. If this is a 🐛 Bug Report, could you please provide a minimum reproducible example (MRE)? This would greatly help us diagnose the issue. Be sure to include all relevant details such as scripts, configurations, and any necessary context.

If you're asking a ❓ Question, please share any additional information that could help us assist you better. For instance, the Python version, operating system details, and how you installed dependencies would be valuable.

Requirements

Ensure your Python version is 3.8.0 or newer and all required dependencies are installed. Make sure PyTorch version is 1.8 or above as well.

Environments

YOLOv5 supports many tested environments such as Notebooks with GPU, cloud platforms, or Docker. Double-check that your environment meets the expected setup.

Status ⬆️

Lastly, you can check our continuous integration (CI) badge on the repository page to see if the latest tests have passed. Our CI tests regularly verify YOLOv5 operations on a variety of platforms.

😄 This is an automated reply to get you started. An Ultralytics engineer will review your question and assist you further soon!

UltralyticsAssistant avatar Dec 13 '24 06:12 UltralyticsAssistant

我的是python3.10

sj746 avatar Dec 13 '24 06:12 sj746

(.venv) dengbiao@dengbiaodeMacBook-Air yolov5-master % python train.py --data new.yaml --weights yolov5s.pt --img 640 train: weights=yolov5s.pt, cfg=, data=new.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data/hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, ndjson_console=False, ndjson_file=False github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5 YOLOv5 🚀 2024-11-25 Python-3.10.11 torch-2.2.2 CPU

hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0 Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet TensorBoard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf to /Users/dengbiao/Library/Application Support/Ultralytics/Arial.ttf... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 976, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 987, in main(opt) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 689, in main train(opt.hyp, opt, device, callbacks) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 204, in train data_dict = data_dict or check_dataset(data) # check if None File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 583, in check_dataset check_font("Arial.ttf" if is_ascii(data["names"]) else "Arial.Unicode.ttf", progress=True) # download fonts File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 519, in check_font torch.hub.download_url_to_file(url, str(file), progress=progress) File "/Users/dengbiao/PycharmProjects/pythonProject1/.venv/lib/python3.10/site-packages/torch/hub.py", line 620, in download_url_to_file u = urlopen(req) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> (.venv) dengbiao@dengbiaodeMacBook-Air yolov5-master % python train.py --data new.yaml --weights yolov5s.pt --img 640 train: weights=yolov5s.pt, cfg=, data=new.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data/hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, ndjson_console=False, ndjson_file=False github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5 YOLOv5 🚀 2024-11-25 Python-3.10.11 torch-2.2.2 CPU

hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0 Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet TensorBoard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf to /Users/dengbiao/Library/Application Support/Ultralytics/Arial.ttf... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 976, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 987, in main(opt) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 689, in main train(opt.hyp, opt, device, callbacks) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 204, in train data_dict = data_dict or check_dataset(data) # check if None File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 583, in check_dataset check_font("Arial.ttf" if is_ascii(data["names"]) else "Arial.Unicode.ttf", progress=True) # download fonts File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 519, in check_font torch.hub.download_url_to_file(url, str(file), progress=progress) File "/Users/dengbiao/PycharmProjects/pythonProject1/.venv/lib/python3.10/site-packages/torch/hub.py", line 620, in download_url_to_file u = urlopen(req) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> (.venv) dengbiao@dengbiaodeMacBook-Air yolov5-master % python train.py --data new.yaml --weights yolov5s.pt --img 640 train: weights=yolov5s.pt, cfg=, data=new.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data/hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, ndjson_console=False, ndjson_file=False github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5 YOLOv5 🚀 2024-11-25 Python-3.10.11 torch-2.2.2 CPU

hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0 Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet TensorBoard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf to /Users/dengbiao/Library/Application Support/Ultralytics/Arial.ttf... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 976, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 987, in main(opt) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 689, in main train(opt.hyp, opt, device, callbacks) File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/train.py", line 204, in train data_dict = data_dict or check_dataset(data) # check if None File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 583, in check_dataset check_font("Arial.ttf" if is_ascii(data["names"]) else "Arial.Unicode.ttf", progress=True) # download fonts File "/Users/dengbiao/PycharmProjects/pythonProject1/yolov5-master/utils/general.py", line 519, in check_font torch.hub.download_url_to_file(url, str(file), progress=progress) File "/Users/dengbiao/PycharmProjects/pythonProject1/.venv/lib/python3.10/site-packages/torch/hub.py", line 620, in download_url_to_file u = urlopen(req) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>

sj746 avatar Dec 13 '24 06:12 sj746

@sj746 the error indicates an SSL certificate verification failure when attempting to download a font file. This is a common issue on macOS where the system's certificate store is not correctly configured for Python.

To resolve this, run the following command to install or update the certificates for Python:

/Applications/Python\ 3.10/Install\ Certificates.command

If you are using a virtual environment, ensure it inherits the certificates from the system installation. After running the command, retry the training script. Let me know if additional issues arise!

pderrenger avatar Dec 13 '24 23:12 pderrenger

OK

邓彪 @.***

广东理工职业学院 学生

---原始邮件--- 发件人: "Paula @.> 发送时间: 2024年12月14日(周六) 上午7:10 收件人: @.>; 抄送: @.@.>; 主题: Re: [ultralytics/yolov5] 为什么mac会抛出这个问题 (Issue #13459)

@sj746 the error indicates an SSL certificate verification failure when attempting to download a font file. This is a common issue on macOS where the system's certificate store is not correctly configured for Python.

To resolve this, run the following command to install or update the certificates for Python: /Applications/Python\ 3.10/Install\ Certificates.command

If you are using a virtual environment, ensure it inherits the certificates from the system installation. After running the command, retry the training script. Let me know if additional issues arise!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

sj746 avatar Dec 17 '24 10:12 sj746

Thank you for the details. As mentioned earlier, the issue is due to SSL certificate verification failure on macOS. Please run /Applications/Python\ 3.10/Install\ Certificates.command to install or update your Python certificates. If you're using a virtual environment, ensure it inherits the updated certificates. After this, retry your training script. Let me know if the problem persists!

pderrenger avatar Dec 17 '24 16:12 pderrenger

好的

邓彪 @.***

广东理工职业学院 学生

---原始邮件--- 发件人: "Paula @.> 发送时间: 2024年12月18日(周三) 凌晨0:51 收件人: @.>; 抄送: @.@.>; 主题: Re: [ultralytics/yolov5] 为什么mac会抛出这个问题 (Issue #13459)

Thank you for the details. As mentioned earlier, the issue is due to SSL certificate verification failure on macOS. Please run /Applications/Python\ 3.10/Install\ Certificates.command to install or update your Python certificates. If you're using a virtual environment, ensure it inherits the updated certificates. After this, retry your training script. Let me know if the problem persists!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

sj746 avatar Dec 17 '24 16:12 sj746

Thank you for confirming. If running /Applications/Python\ 3.10/Install\ Certificates.command resolves the issue, you should be able to proceed without errors. If the problem persists, verify your Python installation and virtual environment setup. Feel free to reach out with any further questions!

pderrenger avatar Dec 18 '24 04:12 pderrenger

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

  • Docs: https://docs.ultralytics.com
  • HUB: https://hub.ultralytics.com
  • Community: https://community.ultralytics.com

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 YOLO 🚀 and Vision AI ⭐

github-actions[bot] avatar Nov 23 '25 00:11 github-actions[bot]