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 2

Complete solution

Shows how to fix sample Code: OpenAI service failed to complete the prompt, APIConnectionError issue with Python 3.10. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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.

Steps

  1. 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.
  2. 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.

When to use

You are seeing this: Create a.env file following these instructions: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md#openai--azure-openai-api-keys 4. Use this skill when you run into "Sample Code: OpenAI service failed to complete the prompt, APIConnectionError issue with Python 3.10".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/microsoft/semantic-kernel/blob/main/python/README.md
  • https://github.com/microsoft/semantic-kernel/blob/main/python/README.md#openai--azure-openai-api-keys
  • https://github.com/microsoft/semantic-kernel/issues/627

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 2 · 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>