Python 3.13.1: Problem Importing openai Module: “No module named ‘pydantic_core._pydantic_core'” /u/Prestigiouspite Python Education

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_pathgenerate.py", line 4, in <module> import openai File "python_installation_pathLibsite-packagesopenai__init__.py", line 8, in <module> from . import types File "python_installation_pathLibsite-packagesopenaitypes__init__.py", line 5, in <module> from .batch import Batch as Batch File "python_installation_pathLibsite-packagesopenaitypesbatch.py", line 7, in <module> from .._models import BaseModel File "python_installation_pathLibsite-packagesopenai_models.py", line 24, in <module> from pydantic.fields import FieldInfo File "python_installation_pathLibsite-packagespydanticfields.py", line 17, in <module> from pydantic_core import PydanticUndefined File "python_installation_pathLibsite-packagespydantic_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 FilesPython313).
  • The libraries, including openai, pydantic, and pydantic_core, are installed using admin cmd with pip and appear in the correct Libsite-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 FilesPython313Libsite-packages Requires: typing-extensions Required-by: pydantic C:WindowsSystem32>pip install pydantic_core Requirement already satisfied: pydantic_core in c:program filespython313libsite-packages (2.27.2) Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in c:program filespython313libsite-packages (from pydantic_core) (4.12.2) 

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

submitted by /u/Prestigiouspite
[link] [comments]

​r/learnpython 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_pathgenerate.py”, line 4, in <module> import openai File “python_installation_pathLibsite-packagesopenai__init__.py”, line 8, in <module> from . import types File “python_installation_pathLibsite-packagesopenaitypes__init__.py”, line 5, in <module> from .batch import Batch as Batch File “python_installation_pathLibsite-packagesopenaitypesbatch.py”, line 7, in <module> from .._models import BaseModel File “python_installation_pathLibsite-packagesopenai_models.py”, line 24, in <module> from pydantic.fields import FieldInfo File “python_installation_pathLibsite-packagespydanticfields.py”, line 17, in <module> from pydantic_core import PydanticUndefined File “python_installation_pathLibsite-packagespydantic_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 FilesPython313). The libraries, including openai, pydantic, and pydantic_core, are installed using admin cmd with pip and appear in the correct Libsite-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 FilesPython313Libsite-packages Requires: typing-extensions Required-by: pydantic C:WindowsSystem32>pip install pydantic_core Requirement already satisfied: pydantic_core in c:program filespython313libsite-packages (2.27.2) Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in c:program filespython313libsite-packages (from pydantic_core) (4.12.2) Everything looks correct to me, doesn’t it? Then why does it keep failing? submitted by /u/Prestigiouspite [link] [comments] 

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_pathgenerate.py", line 4, in <module> import openai File "python_installation_pathLibsite-packagesopenai__init__.py", line 8, in <module> from . import types File "python_installation_pathLibsite-packagesopenaitypes__init__.py", line 5, in <module> from .batch import Batch as Batch File "python_installation_pathLibsite-packagesopenaitypesbatch.py", line 7, in <module> from .._models import BaseModel File "python_installation_pathLibsite-packagesopenai_models.py", line 24, in <module> from pydantic.fields import FieldInfo File "python_installation_pathLibsite-packagespydanticfields.py", line 17, in <module> from pydantic_core import PydanticUndefined File "python_installation_pathLibsite-packagespydantic_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 FilesPython313).
  • The libraries, including openai, pydantic, and pydantic_core, are installed using admin cmd with pip and appear in the correct Libsite-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 FilesPython313Libsite-packages Requires: typing-extensions Required-by: pydantic C:WindowsSystem32>pip install pydantic_core Requirement already satisfied: pydantic_core in c:program filespython313libsite-packages (2.27.2) Requirement already satisfied: typing-extensions!=4.7.0,>=4.6.0 in c:program filespython313libsite-packages (from pydantic_core) (4.12.2) 

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

submitted by /u/Prestigiouspite
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *