← All tasks
pythonfastapi/fastapi #9566Not a task: already works

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

envgap__fastapi__fastapi-9566

01 / FAILURE SIGNATURE

As reported upstream

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)
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
8cc967a7605d3883bd04ceb5d25cc94ae079612f
Manifest
pyproject.toml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

fastapi/fastapi #9566 · read the original issue
### Discussed in https://github.com/tiangolo/fastapi/discussions/9565



<div type='discussions-op-text'>



<sup>Originally posted by **ZiChuanBuXiu** May 23, 2023</sup>

### First Check



- [X] I added a very descriptive title here.

- [X] I used the GitHub search to find a similar question and didn't find it.

- [X] I searched the FastAPI documentation, with the integrated search.

- [X] I already searched in Google "How to X in FastAPI" and didn't find any information.

- [X] I already read and followed all the tutorial in the docs and didn't find an answer.

- [X] I already checked if it is not related to FastAPI but to [Pydantic](https://github.com/pydantic/pydantic).

- [X] I already checked if it is not related to FastAPI but to [Swagger UI](https://github.com/swagger-api/swagger-ui).

- [X] I already checked if it is not related to FastAPI but to [ReDoc](https://github.com/Redocly/redoc).



### Commit to Help



- [X] I commit to help with one of those options 👆



### Example Code



```python

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](https://github.com/tiangolo/fastapi/blob/0.95.2/pyproject.toml#L45) 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](https://github.com/pydantic/pydantic/blob/v1.6.2/pydantic/typing.py) 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_</div>
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]