SciPhi-AI / R2R

The Supabase for RAG - R2R lets you build, scale, and manage user-facing Retrieval-Augmented Generation applications in production.

Home Page:https://r2r-docs.sciphi.ai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No module named 'pydantic_core._pydantic_core'

jamesfishwick opened this issue · comments

Describe the bug
When I use Python3 (Python 3.12.3) as installed by homebrew on my Mac, the python -m r2r.examples.servers.basic_pipeline --config local_ollama command errors out with:

File "/Users/user/rag2riches/pydantic/main.py", line 12, in <module>
    import pydantic_core
  File "/Users/user/rag2riches/pydantic_core/__init__.py", line 6, in <module>
    from ._pydantic_core import (
ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'

but I have pydantic_core on my machine:

pip show pydantic_core
Name: pydantic_core
Version: 2.16.3
Summary: 
Home-page: https://github.com/pydantic/pydantic-core
Author: 
Author-email: Samuel Colvin <s@muelcolvin.com>
License: MIT
Location: /Users/user/.local/lib/python/site-packages
Requires: typing-extensions
Required-by: pydantic

Expected behavior
The server runs.

Desktop (please complete the following information):

  • OS: OSX 12.7.4

Additional context
This was working running from the native OSX python instance, but LibreSSL was causing errors when I was trying to run https://github.com/SciPhi-AI/SciPhi-Demo, so I switched to a proper install of python. This error occurs whether or not I use a virtual environment.

This is strange, is this an error due to the version of pydantic?

I will try to replicate so that we can diagnose and fix - any additional information or attempts at solving would be helpful for us to pin down why this is occurring.

fwiw

  • pydantic_core: 2.16.3
  • pydantic: 2.6.3
  • fastapi: 0.109.2

Here's the whole error:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/r2r/examples/servers/basic_pipeline.py", line 6, in <module>
    from r2r.main import E2EPipelineFactory, R2RConfig
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/r2r/main/__init__.py", line 1, in <module>
    from .app import create_app
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/r2r/main/app.py", line 7, in <module>
    from fastapi import (
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/applications.py", line 16, in <module>
    from fastapi import routing
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/routing.py", line 22, in <module>
    from fastapi import params
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/params.py", line 5, in <module>
    from fastapi.openapi.models import Example
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/openapi/models.py", line 4, in <module>
    from fastapi._compat import (
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/_compat.py", line 20, in <module>
    from fastapi.exceptions import RequestErrorModel
  File "/Users/user/rag2riches/venv/lib/python3.12/site-packages/fastapi/exceptions.py", line 3, in <module>
    from pydantic import BaseModel, create_model
  File "/Users/user/rag2riches/pydantic/__init__.py", line 389, in __getattr__
    module = import_module(module_name, package=package)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/rag2riches/pydantic/main.py", line 12, in <module>
    import pydantic_core
  File "/Users/user/rag2riches/pydantic_core/__init__.py", line 6, in <module>
    from ._pydantic_core import (
ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'

Most of the Google results for this issue bring up folks who are having trouble getting suitable packages built for a specific architecture https://stackoverflow.com/questions/76650856/no-module-named-pydantic-core-pydantic-core-in-aws-lambda-though-library-is-i

for me I see:

  • fastapi-0.109.2-py3-none-any.whl.metadata
  • pydantic-2.6.3-py3-none-any.whl.metadata
  • pydantic_core-2.16.3-cp312-cp312-macosx_10_12_x86_64.whl.metadata