Getting error with openai 1.3.5 python openai api connection error

raise to_exc(exc) from exc

httpcore. ConnectError: [SSL: WRONG_VERSION NUMBER] wrong version number (_ssl.c:1006)

raise APIConnectionError(request-request) from err

openai.APIConnectionError: Connection error.

Hi and welcome to the Developer Forum!

What version of python are you using?, I’m running 3.8 without any problems.

Hi
I am using python version 3.11

In that case, it’s going to be 1 of a couple of possibilities, one is your urllib3 version which you can downgrade to 1.23 and give that a try pip3 install urllib3==1.23, or you may be using a proxy of some sort and not actually specifying it as in this reply

image

I have used pip3 install urllib3==1.23 with python version 11
Now i am getting this error
File “D: \Llama Workspace\LlamaIndex_POC. venv\Lib\site-packages \httpx_transports \default.py”, 1i raise mapped_exc (message) from exc

httUnsupportedProtocol: Request URL is missing an http://’ or •https://• protocol.
File “D: ALlama Workspace LLlamaIndex POCI. venv\Lib\site-packages \openai base _client py”, line 9 Traise APIConnectionError (request-request) from err

openai.APIConnectionError: Connection error.

It sounds like you might need to review your environment path variable, and have it pointing to the correct install directory for OS python with no others.

system properties → advanced → environment variables → system

While there, an OPENAI_API_KEY would be good to add…

You should not type “pip3”, but instead “pip”. That also could be searching alternate paths to find different pythons.