No you don't need to explicitly include pydantic or pydantic_core if using it via FastAPI.
pip install fastapi
lets import pydantic
and import pydantic_core._pydantic_core
run just fine. In fact the error might be caused by explicitly including pydantic (with a v1 version?) in the dependencies, but can't really say without further info. @krish___na please can you make a new question with more info, this one gives no details on how the packages are installed, so it's hard to reproduce your problem, and comments aren't appropriate for describing separate cases.