-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'
when importing from mcp.server
even though pydantic-core
is installed
#570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Have same issue |
Could you provide your Dockerfile, as a MRE so that I can reproduce? More importantly, what is your host platform? |
same issue, using python alpine as baseimage. sample Dockefile
on run, I have
|
@marcoimme you are installing your dependencies on a different image than the one used to run the application. Alpine uses musl, which requires musl wheels to be used when installing Does it used to work? Or did you just encounter the issue when trying to setup your Dockerfile? |
the error occurred during docker run, the build worked properly. I workarounded the issue installing pydantic-core from alpine repo now my Dockerfile looks like that
and it runs |
@Viicos Here’s a minimal Dockerfile that can be used to reproduce the issue. It's based on the LibreChat Dockerfile, which I was originally using: https://github.com/danny-avila/LibreChat/blob/main/Dockerfile FROM node:20-alpine
# Install basic deps
RUN apk add --no-cache curl
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /app
# Create a Python 3.11 virtual environment
RUN uv venv --python=3.11 && \
uv pip install mcp
# Install the MCP server
# Add test file
COPY test_mcp.py .
# Run the test
CMD ["uv", "run", "test_mcp.py"]
test_mcp.py
Build and run Dockerfile
Error:
In my case, I was trying to run this MCP server inside the Docker container: https://github.com/vivekVells/mcp-pandoc The
|
Up until 3.13, Python wasn't properly inferring the extension suffix for shared libraries. This was fixed in python/cpython#95855, so you need to use Python 3.13 or latter. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I'm using the
mcp
package (version1.6.0
) in a Docker container based onnode:20-alpine
, running Python 3.11.12. When I try to importNotificationOptions
andServer
frommcp.server
, I get the following error:Even though
pydantic-core==2.33.1
andpydantic==2.11.3
are already installed.To Reproduce
Steps to reproduce the behavior:
node:20-alpine
mcp==1.6.0
usinguv pip install
ModuleNotFoundError
forpydantic_core._pydantic_core
Expected behavior
The import should work as expected since
pydantic-core
is installed. There should be no missing module error if dependencies are properly installed.Screenshots
Desktop (please complete the following information):
node:20-alpine
)uv pip install mcp==1.6.0
Smartphone (please complete the following information):
Not applicable.
Additional context
Here is the relevant part of
uv pip freeze
:The text was updated successfully, but these errors were encountered: