Use the Ctrl+Shift+P command, search for and select Python:Select Interpreter(Or click directly on the python version displayed in the lower right corner), and select the correct interpreter.

Answer from MingJie-MSFT on Stack Overflow
🌐
GitHub
github.com › pydantic › pydantic › discussions › 5185
Pydantic import error in fastapi · pydantic/pydantic · Discussion #5185
This issue originally came up as I was having issues with uvicorn but as I've been trying to work out a fix I've started getting pydantic errors. I'm running in a virtual environment using pyenv and tried multiple versions of python, so I'm guessing it must be an issue with some packages not playing well with arm64 as I'm on an M1 mac.
Author   pydantic
Discussions

No module named 'pydantic_core._pydantic_core' using AWS Lambdas
Initial Checks I confirm that I'm using Pydantic V2 installed directly from the main branch, or equivalent Description I have pydantic 2.0.2 installed into my AWS Lambda with python3.10 and whe... More on github.com
🌐 github.com
106
July 10, 2023
help, getting this error message ImportError: cannot import name 'Undefined' from 'pydantic.fields'
Looking into it, it looks like it's a version compatibility issue. https://github.com/oobabooga/text-generation-webui/issues/3850 You need to manually edit the "requirements.txt", line 2 - change it to "fastapi==0.103.1". "gradio_client==0.5.0" then: pip install --upgrade gradio . This may be a dumb question, but are you running it from the same location? Oobabooga, the way it is installed, looks for files in specific folders in relation to the Oobabooga install. Open the "cmd_windows.bat" file. This will open up the CMD prompt in the appropriate environment. Type "pip show pydantic" This will confirm whether pydantic is installed in the environment. If you're still having trouble, copy the entire block that traces the error. More on reddit.com
🌐 r/Oobabooga
31
9
September 10, 2023
python - Why can't the import be resolved? - Stack Overflow
I've seen several answers to this question, albeit none of the solutions have worked for my particular situation. I'm trying to get started building an API with Flask. When I try to import Flask-RE... More on stackoverflow.com
🌐 stackoverflow.com
python - ModuleNotFoundError: No module named 'pydantic' - Stack Overflow
from pydantic import BaseModel on debug mode with PyCharm also after install pydantic print ModuleNotFoundError: No module named 'pydantic' More on stackoverflow.com
🌐 stackoverflow.com
🌐
Pydantic
docs.pydantic.dev › latest › errors › usage_errors
Usage Errors | Pydantic Docs
from pydantic import BaseModel, ... exc_info.code == 'model-field-missing-annotation' If the field is not meant to be a field, you may be able to resolve the error by ......
🌐
Finxter
blog.finxter.com › fixed-modulenotfounderror-no-module-named-pydantic
[Fixed] ModuleNotFoundError: No module named ‘pydantic’ – Be on the Right Side of Change
June 12, 2022 - >>> import pydantic Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> import pydantic ModuleNotFoundError: No module named 'pydantic' The most likely reason is that Python doesn’t provide pydantic in its standard library. You need to install it first! Before being ...
🌐
GitHub
github.com › pydantic › pydantic › issues › 6557
No module named 'pydantic_core._pydantic_core' using AWS Lambdas · Issue #6557 · pydantic/pydantic
July 10, 2023 - [ERROR] Runtime.ImportModuleError: Unable to import module 'app': No module named 'pydantic_core._pydantic_core' Traceback (most recent call last):
Author   pydantic
🌐
Reddit
reddit.com › r/oobabooga › help, getting this error message importerror: cannot import name 'undefined' from 'pydantic.fields'
r/Oobabooga on Reddit: help, getting this error message ImportError: cannot import name 'Undefined' from 'pydantic.fields'
September 10, 2023 -

Hi, my Oobabooga installation suddenly stop working today. It was working fine yesterday and today I am getting this error:

ImportError: cannot import name 'Undefined' from 'pydantic.fields' E:\Oobabooga\installer_files\env\lib\site-packages\pydantic\fields.py)

I am on windows and don't know much about linux or python. I already tried update a couple of times and it's saying I am up to date. Any idea for a quick fix?

Find elsewhere
🌐
Reddit
reddit.com › r/neovim › weird pyright behavior with import resolution
r/neovim on Reddit: Weird pyright behavior with import resolution
January 14, 2024 -

I have a project setup as follows:

├── khorne
│   ├── Dockerfile
│   ├── Makefile
│   ├── pyproject.toml
│   ├── requirements-qa.txt
│   ├── requirements.txt
│   ├── src
│   │   └── domain
│   │       ├── __init__.py
│   │       ├── entities.py
│   │       ├── events.py
│   │       ├── services.py
│   │       └── values.py
|   ├── .venv

Inside the pyproject.toml there is a section for pyright:

[tool.pyright]
include = ["src"]
executionEnvironments = [
    { root = "src" }
]

LspInfo shows the correct root directory: /home/jakov/Projects/metaflaff/khorne

However when I import e.g. pydantic I get the message Import pydantic could not be resolved

However however, if I do source .venv/bin/activate and THEN open neovim the path is correctly resolved.

This will be limiting when working with multi root projects. I use default settings for pyright.

Does anyone have an idea what the root cause could be?

🌐
GitHub
github.com › pydantic › pydantic › issues › 6701
import issue · Issue #6701 · pydantic/pydantic
July 16, 2023 - I am not sure, but maybe this is not a big but due to recent changes in the pydantic api, could it be? ... (fastapi) ➜ ~ pip install -U git+https://github.com/pydantic/pydantic Collecting git+https://github.com/pydantic/pydantic Cloning https://github.com/pydantic/pydantic to /tmp/pip-req-build-iemrdmn_ Running command git clone --filter=blob:none --quiet https://github.com/pydantic/pydantic /tmp/pip-req-build-iemrdmn_ Resolved https://github.com/pydantic/pydantic to commit d9bf7f70f6f853e799eeffb3dbfadb06527993b9 Installing build dependencies ...
Author   pydantic
🌐
Streamlit
discuss.streamlit.io › community cloud
Pydantic Import Error for an old repo - Community Cloud - Streamlit
February 5, 2024 - Greetings, I just happened to visit an old app which I had deployed 2 years ago and it now says **pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.6/migration/#basesettings-has-moved-to-pydantic-settings for more details.** Below is a link to my repo: AutoPlot.py Is there something that I have to add in the requirements.txt?
🌐
Reddit
reddit.com › r/learnpython › python 3.13.1: problem importing openai module: "no module named 'pydantic_core._pydantic_core'"
r/learnpython on Reddit: Python 3.13.1: Problem Importing openai Module: "No module named 'pydantic_core._pydantic_core'"
January 22, 2025 -

Problem

I'm facing an issue when trying to run a Python script that uses the openai library. Here's the traceback I get:

Traceback (most recent call last):
  File "script_path\generate.py", line 4, in <module>
    import openai
  File "python_installation_path\Lib\site-packages\openai\__init__.py", line 8, in <module>
    from . import types
  File "python_installation_path\Lib\site-packages\openai\types\__init__.py", line 5, in <module>
    from .batch import Batch as Batch
  File "python_installation_path\Lib\site-packages\openai\types\batch.py", line 7, in <module>
    from .._models import BaseModel
  File "python_installation_path\Lib\site-packages\openai\_models.py", line 24, in <module>
    from pydantic.fields import FieldInfo
  File "python_installation_path\Lib\site-packages\pydantic\fields.py", line 17, in <module>
    from pydantic_core import PydanticUndefined
  File "python_installation_path\Lib\site-packages\pydantic_core\__init__.py", line 6, in <module>
    from ._pydantic_core import (
    ...<22 lines>...
    )
ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'

Context:

  • Python version: 3.13 (installed system-wide on Windows 11, 64-bit at C:\Program Files\Python313).

  • The libraries, including openai, pydantic, and pydantic_core, are installed using admin cmd with pip and appear in the correct Lib\site-packages directory.

  • The file _pydantic_core.cp313-win_amd64.pyd is present in the pydantic_core folder, but the error persists.

What I've Tried:

pip uninstall pydantic pydantic_core openai
pip install pydantic pydantic_core openai

I don't quite understand the context here. There has also been a problem with annotated-types in connection with OpenAI.

pip show pydantic_core
Name: pydantic_core
Version: 2.27.2
...
Location: C:\Program Files\Python313\Lib\site-packages
Requires: typing-extensions
Required-by: pydantic

C:\Windows\System32>pip install pydantic_core
Requirement already satisfied: pydantic_core in c:\program files\python313\lib\site-packages (2.27.2)
Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in c:\program files\python313\lib\site-packages (from pydantic_core) (4.12.2)

Everything looks correct to me, doesn't it? Then why does it keep failing?

🌐
Prodigy
support.prodi.gy › getting started
cannot import name 'Schema' from 'pydantic' - Getting Started - Prodigy Support
August 31, 2021 - Hi, Im going to load my custom prodigy web-app using docker. However, I got this error: the version of installed pydantic, spacy and prodigy are as follow: pydantic==1.7 spacy==2.3.7 prodigy==1.10.8 I already ra…
🌐
Napari
napari.org › 0.4.15 › _modules › npe2 › manifest › schema.html
Source code for npe2.manifest.schema
ValueError If the name does not resolve to either a distribution name or a filename. """ from pydantic import ValidationError from npe2 import PluginManifest try: return PluginManifest.from_file(package_or_filename) except ValidationError: # pragma: no cover raise except (FileNotFoundError, ValueError): try: return PluginManifest.from_distribution(str(package_or_filename)) except ValidationError: # pragma: no cover raise except Exception as e: raise ValueError( f"Could ...
🌐
Pydantic
docs.pydantic.dev › latest › integrations › visual_studio_code
Visual Studio Code | Pydantic Docs
But there are cases, like with age='23', where they could be inconvenient by reporting a “false positive” error. This example above with age='23' is intentionally simple, to show the error and the differences in types. But more common cases where these strict errors would be inconvenient would be when using more sophisticated data types, like int values for datetime fields, or dict values for Pydantic sub-models. ... from pydantic import BaseModel class Knight(BaseModel): title: str age: int color: str = 'blue' class Quest(BaseModel): title: str knight: Knight quest = Quest( title='To seek the Holy Grail', knight={'title': 'Sir Lancelot', 'age': 23} )
🌐
Pydantic
docs.pydantic.dev › latest › install
Installation | Pydantic Docs
Installation is as simple as: · Pydantic has a few dependencies:
🌐
Reddit
reddit.com › r/techsupport › hi guys, please help me solve this issue if you belong to python domain and have knowledge about colab and its libraries importing errors.
r/techsupport on Reddit: hi guys, please help me solve this issue if you belong to python domain and have knowledge about colab and its libraries importing errors.
August 1, 2024 - PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.8/migration/#basesettings-has-moved-to-pydantic-settings for more details. For further information visit https://errors.pydantic.dev/2.8/u/import-error