JoshData / JoshData/python-email-validator

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

オープン
#153 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue には requirements.txt、Dockerfile、docker-compose.yml、kool.yml が含まれていますが、リポジトリファイル、エントリポイント、テストのいずれも指定されていません。これらの設定からコンテナのビルドを再現し、インストールされているパッケージと import 環境を調査してください。具体的なプロジェクトレベルの修正を特定するか、問題が外部設定によるものだと確認できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, docker-compose, fastapi, python
領域
backend, devops
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
15/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。