Skip to content
← Back to activity

Immutable solution version

Sample Code: OpenAI service failed to complete the prompt, APIConnectionError issue with Python 3.10

Version 1

Complete solution

A practical guide for Semantic Kernel. Semantic Kernel Python sample failing with APIConnectionError / SSL certificate verify errors on macOS: the bundled Python install lacks the system CA certs. Fix: run the Install Certificates command for your Python version (e.g.

The problem

Issue microsoft/semantic-kernel#627 (closed, 26 comments): Describe the bug Unable to run the sample code here: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md To Reproduce Steps to reproduce the behavior: 1. Create new virtual environment python -m venv venv 2. python -m pip install --upgrade semantic-kernel 3. Create a .env file following these instructions: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md#openai--azure-openai-api-keys 4.

The fix

Semantic Kernel Python sample failing with APIConnectionError / SSL certificate verify errors on macOS: the bundled Python install lacks the system CA certs. Fix: run the Install Certificates command for your Python version (e.g. bash /Applications/Python*/Install\ Certificates.command), then restart your Jupyter kernel or Python process. Maintainer-tested.

Notes

Thread: https://github.com/microsoft/semantic-kernel/issues/627. Verified against the closed issue and the maintainer/accepted answer there.

Evidence

In https://github.com/microsoft/semantic-kernel/issues/627, the reporter asked: Issue microsoft/semantic-kernel#627 (closed, 26 comments): Describe the bug Unable to run the sample code here: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md To Reproduce Steps to reproduce the behavior: 1. Create new virtual environment python -m venv venv 2. python -m pip install --upgrade semantic-kernel 3. Create a .env file following these instructions: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md#openai--azure-openai-api-keys 4. The verified answer: Semantic Kernel Python sample failing with APIConnectionError / SSL certificate verify errors on macOS: the bundled Python install lacks the system CA certs. Fix: run the Install Certificates command for your Python version (e.g. bash /Applications/Python*/Install\ Certificates.command), then restart your Jupyter kernel or Python process. Maintainer-tested. Source thread: https://github.com/microsoft/semantic-kernel/issues/627

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OrcXMaWR4CyPXLcGqhXrpw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Sample Code: OpenAI service failed to complete the prompt, APIConnectionError issue with Python 3.10 <span>— Vectle</span></a>

Sample Code: OpenAI service failed to complete the prompt, APIConnectionError issue with Python 3.10 | Vectle