langchain-ai / langserve

LangServe 🦜️🏓
Other
1.96k stars 220 forks source link

ImportError: cannot import name 'VerifyTypes' from 'httpx._types' #796

Open laithalsaadoon opened 3 days ago

laithalsaadoon commented 3 days ago

langserve/client.py imports VerifyTypes from encode/httpx ._types and results in an import error. I did a bit of digging on commit history in this repo and httpx and can't figure out what is the breaking change, or when this 'VerifyTypes' thing went missing 🤷

Simply removing VerifyTypes from client.py line 24 fixes the import error.

Environment:

❯ python --version && pip list
Python 3.12.7
Package                  Version
------------------------ -----------
aiohappyeyeballs         2.4.3
aiohttp                  3.11.8
aiosignal                1.3.1
annotated-types          0.7.0
anyio                    4.6.2.post1
attrs                    24.2.0
bandit                   1.8.0
boto3                    1.35.71
boto3-stubs              1.35.71
boto3-stubs-full         1.35.71
botocore                 1.35.71
botocore-stubs           1.35.71
certifi                  2024.8.30
charset-normalizer       3.4.0
click                    8.1.7
fastapi                  0.115.5
frozenlist               1.5.0
greenlet                 3.1.1
h11                      0.14.0
httpcore                 1.0.7
httpx                    0.28.0
httpx-sse                0.4.0
idna                     3.10
iniconfig                2.0.0
jmespath                 1.0.1
jsonpatch                1.33
jsonpointer              3.0.0
langchain                0.3.9
langchain-aws            0.2.7
langchain-core           0.3.21
langchain-text-splitters 0.3.2
langgraph                0.2.53
langgraph-checkpoint     2.0.7
langgraph-sdk            0.1.40
langserve                0.3.0
langsmith                0.1.147
loguru                   0.7.2
markdown-it-py           3.0.0
mdurl                    0.1.2
msgpack                  1.1.0
multidict                6.1.0
numpy                    1.26.4
orjson                   3.10.12
packaging                24.2
pandas                   2.2.3
pbr                      6.1.0
pdf2image                1.17.0
pillow                   11.0.0
pip                      24.2
pluggy                   1.5.0
propcache                0.2.0
pydantic                 2.10.2
pydantic_core            2.27.1
Pygments                 2.18.0
pytest                   8.3.3
python-dateutil          2.9.0.post0
pytz                     2024.2
PyYAML                   6.0.2
requests                 2.32.3
requests-toolbelt        1.0.0
rich                     13.9.4
ruff                     0.7.4
s3transfer               0.10.4
six                      1.16.0
sniffio                  1.3.1
SQLAlchemy               2.0.36
sse-starlette            2.1.3
starlette                0.41.3
stevedore                5.4.0
tenacity                 9.0.0
types-awscrt             0.23.1
types-s3transfer         0.10.4
typing_extensions        4.12.2
tzdata                   2024.2
urllib3                  2.2.3
uvicorn                  0.32.1
yarl                     1.18.0
krmarien commented 3 days ago

Downgrading httpx to 0.27.2 will resolve the issue for now

IvanZidov commented 3 days ago

Thanks. Same issue here

xxsl commented 1 day ago

Since the version 0.28.0 of httpx which was released 4 days ago, they seem to change the API a little bit at SSL verifying part.

The 0.28 release includes a limited set of deprecations.

Deprecations:

We are working towards a simplified SSL configuration API.

For users of the standard verify=True or verify=False cases, or verify=<ssl_context> case this should require no changes. The following cases have been deprecated...

The verify argument as a string argument is now deprecated and will raise warnings.
The cert argument is now deprecated and will raise warnings.

Also see here: https://github.com/encode/httpx/blob/0.28.0/docs/advanced/ssl.md

So in httpx source, there is no VerifyTypes anymore,

In previous version (0.27.2) was:

verify: VerifyTypes = True,

=>

Current version (0.28.0)

verify: ssl.SSLContext | str | bool = True,

Have made a update for this issue (PR #798), I don't know if the maintainer will merge this.

Before this get accepted by the maintainer,

pip install httpx==0.27.2

can be a dirty fix instead