JoshData / JoshData/python-email-validator

:bug: ImportError: email-validator is not installed using Docker, Pydantic and Kool

未关闭
#153 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
1.4k
派生
140
PR 合并指标
30 天内没有已合并 PR

描述

Hi Josh,

I’m currently using the email-validator package for a model in FastAPI to validate email addresses.

However, when deploying the code inside a Docker container, I encounter the following error:

ImportError: email-validator is not installed, run

pip install pydantic[email]

I’ve already included the email-validator package in my requirements.txt file and tested different versions, ranging from 1.0.9 to the latest version, alongside Pydantic. Unfortunately, the issue persists.

I’m attaching the configuration files used in my project for your reference.

requirements.txt

fastapi
uvicorn
pydantic==2.10
email-validator
pydantic[email]

Dockerfile

FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .
COPY . .

RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

docker-compose.yml

version: "3.8"

services:
  fastapi:
    build:
      context: .
    ports:
      - "9000:8000"
    volumes:
      - .:/app
      - /app/__pycache__/
    environment:
      - PYTHONUNBUFFERED=1
    command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload

kool.yml

name: fastapi-app

services:
  - fastapi

scripts:
  build:
    - docker-compose build
  start:
    - kool run build
    - docker-compose up
  stop:
    - docker-compose down
  restart:
    - kool stop
    - kool start

Do you have any idea where I might be going wrong?

Best regards from Mexico,
Alberto

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

该 issue 包含 requirements.txt、Dockerfile、docker-compose.yml 和 kool.yml,但未指定任何 repository 文件、入口点或测试。根据这些配置复现容器构建,并检查已安装的软件包和导入环境。完成标准是确定具体的项目级修复,或确认问题源于外部配置。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, docker-compose, fastapi, python
领域
backend, devops
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
15/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。