You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm this is an issue with the Python library and not an underlying OpenAI API
This is an issue with the Python library
Describe the bug
httpx version 0.28.0 removes the deprecated proxies argument; this argument is hardcoded in the library at the moment.
To Reproduce
Update to httpx version 0.28.0
Code snippets
File "/var/lang/lib/python3.10/site-packages/openai/_client.py", line 337, in __init__
super().__init__(
File "/var/lang/lib/python3.10/site-packages/openai/_base_client.py", line 1438, in __init__
self._client = http_client or AsyncHttpxClientWrapper(
File "/var/lang/lib/python3.10/site-packages/openai/_base_client.py", line 1335, in __init__
super().__init__(**kwargs)
TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies'
OS
macOS
Python version
Python 3.10.12
Library version
openai-1.55.2
Reacted by Sam El-Borai, GriesserP, Lukas Innig, busbaby, Guilherme Brito, RechaviaAmit, Jan Heimes, Arina Razmyslovich, xiaoyan5686670 and hunter2009pf
This is causing a fresh install of openai to be broken currently.
Here's a reproducer: (Dockerfile)
from alpine:edge
RUN apk update
RUN apk add python3 py3-pip
RUN pip install --break-system-packages openai
RUN python -c 'import openai; client=openai.AsyncOpenAI(api_key="X")'
Gives:
=> ERROR [5/5] RUN python -c 'import openai; client=openai.AsyncOpenAI(api_key="X")' 0.4s
------
> [5/5] RUN python -c 'import openai; client=openai.AsyncOpenAI(api_key="X")':
0.307 Traceback (most recent call last):
0.307 File "<string>", line 1, in <module>
0.307 File "/usr/lib/python3.12/site-packages/openai/_client.py", line 337, in __init__
0.307 super().__init__(
0.307 File "/usr/lib/python3.12/site-packages/openai/_base_client.py", line 1438, in __init__
0.307 self._client = http_client or AsyncHttpxClientWrapper(
0.307 ^^^^^^^^^^^^^^^^^^^^^^^^
0.307 File "/usr/lib/python3.12/site-packages/openai/_base_client.py", line 1335, in __init__
0.308 super().__init__(**kwargs)
0.308 TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies'
------
Dockerfile:7
--------------------
5 |
6 | RUN pip install --break-system-packages openai
7 | >>> RUN python -c 'import openai; client=openai.AsyncOpenAI(api_key="X")'
8 |
--------------------
Reacted by Lee Harrold, Martin Blaha and zack-causalens
Having this issue too, with the synchronous client. A temporary fix I've found is to hardcode the httpx version in my requirements to the previous release, which is 0.27.2.
Just adding httpx==0.27.2 makes my code work again.
Reacted by zack-causalens, Martin Blaha, Loïc MARIE, Mihailo, Germán Calcedo, Bhargav v, amengus87, Mykyta Svyrydenko, Jimmy9966, Andres Barbaro and 8 more
Reacted by Lee Harrold, Alaa Kaddour, Miguel Dario Trosel Manrique, amengus87, Mykyta Svyrydenko, Jimmy9966, André Pedersen, Haiyang Sun, dncq, Ali Emre Kaya and 1 more
@dgellow@RobertCraigie In the pyproject.toml file, the httpx version is defined as httpx>=0.23.0, <1. Isn't this too wide? It seems to me the dependent libraries versions should only include the current and tested versions. But <1 allows many future upgrades that can potentially break stuff like the current issue. Other dependent libraries are defined in the same manner and seems to have the same issue.
Hi @vvaezian, thanks for pointing that out. I tend to agree, though I'm not sure how strict the version range should be in this specific context. That's something we identified and will be discussing today as part of our internal post-mortem for that httpx v0.28.0 incident. I expect we will share an update later today in this thread.
@vvaezian Following up on your question, we decided against narrowing the version constraints. Instead we decided to invest into improving our testing setup to be sure we have coverage for nightly/dev versions of httpx (and other core dependencies), before they are released publicly.
Activity
stestagg commentedon Nov 28, 2024
This is causing a fresh install of openai to be broken currently.
Here's a reproducer: (Dockerfile)
Gives:
Pablo-Merino commentedon Nov 28, 2024
Having this issue too, with the synchronous client. A temporary fix I've found is to hardcode the
httpxversion in my requirements to the previous release, which is0.27.2.Just adding
httpx==0.27.2makes my code work again.dgellow commentedon Nov 28, 2024
Hi, thank you for the reports, we (@stainless-api) are actively working on a fix.
Edit: we have a patch under review right now and expect to push it to this repo in a few minutes
RobertCraigie commentedon Nov 28, 2024
Thanks for the reports, this will be fixed shortly
dgellow commentedon Nov 28, 2024
Should be fixed once #1905 gets merged (all the credits to the amazing @RobertCraigie for the quick fix)
RobertCraigie commentedon Nov 28, 2024
Sorry for the delay, we're trying to get a hold of someone with the credentials to publish a new release.
stainless-app commentedon Nov 28, 2024
Fixed by #1905
vvaezian commentedon Dec 1, 2024
@dgellow @RobertCraigie In the pyproject.toml file, the httpx version is defined as
httpx>=0.23.0, <1. Isn't this too wide? It seems to me the dependent libraries versions should only include the current and tested versions. But<1allows many future upgrades that can potentially break stuff like the current issue. Other dependent libraries are defined in the same manner and seems to have the same issue.dgellow commentedon Dec 2, 2024
Hi @vvaezian, thanks for pointing that out. I tend to agree, though I'm not sure how strict the version range should be in this specific context. That's something we identified and will be discussing today as part of our internal post-mortem for that httpx v0.28.0 incident. I expect we will share an update later today in this thread.
kristapratico commentedon Dec 2, 2024
@dgellow @RobertCraigie FYI it looks like we need the same fix in the CLI:
openai-python/src/openai/cli/_cli.py
Lines 179 to 182 in 534d6c5
RobertCraigie commentedon Dec 2, 2024
ah good catch thank you!
dgellow commentedon Dec 5, 2024
@vvaezian Following up on your question, we decided against narrowing the version constraints. Instead we decided to invest into improving our testing setup to be sure we have coverage for nightly/dev versions of httpx (and other core dependencies), before they are released publicly.
openai library fix
chore(deps): set openai dependency to >=1.55.3 (#3366)
fix: use openai client 1.76.0 in vllm_inference.py
fix: use openai client 1.76.0 in vllm_inference.py (#1143)
fix: use openai client 1.76.0 in vllm_inference.py (#1143)