Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: cannot import name 'get_args' from 'pydantic.typing' #9566

Closed
9 tasks done
Kludex opened this issue May 24, 2023 Discussed in #9565 · 1 comment · Fixed by #9567
Closed
9 tasks done

Exception: cannot import name 'get_args' from 'pydantic.typing' #9566

Kludex opened this issue May 24, 2023 Discussed in #9565 · 1 comment · Fixed by #9567
Labels
bug Something isn't working question Question or problem

Comments

@Kludex
Copy link
Sponsor Collaborator

Kludex commented May 24, 2023

Discussed in #9565

Originally posted by ZiChuanBuXiu May 23, 2023

First Check

  • I added a very descriptive title here.
  • I used the GitHub search to find a similar question and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

NA

Description

from pydantic.typing import evaluate_forwardref, get_args, get_origin
ImportError: cannot import name 'get_args' from 'pydantic.typing' (/Users/yfeng/Library/Caches/pypoetry/virtualenvs/aips-cq-resource-api-F3u0rVOe-py3.8/lib/python3.8/site-packages/pydantic/typing.cpython-38-darwin.so)

In fastapi=0.95.2, the dependency on pydantic is here which indicates pydantic=1.6.2 can be used. But get_args is only available in pydantic>=1.7, while pydantic=1.6.2 code doesn't have this

Operating System

macOS

Operating System Details

No response

FastAPI Version

0.95.2

Python Version

3.8

Additional Context

No response

@Kludex Kludex added bug Something isn't working question Question or problem labels May 24, 2023
@tiangolo
Copy link
Owner

tiangolo commented Jun 8, 2023

Thanks a lot for the investigation here! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Question or problem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants