JoshData / JoshData/python-email-validator

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

Đang mở
#153 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
1.4k
Fork
140
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Issue bao gồm requirements.txt, Dockerfile, docker-compose.yml và kool.yml, nhưng không nêu tệp nào trong repository, entry point hay test. Hãy tái hiện quá trình build container từ các cấu hình này và kiểm tra các package đã cài đặt cùng môi trường import. Được xem là hoàn tất khi xác định được một cách khắc phục cụ thể ở cấp project hoặc xác nhận rằng vấn đề nằm ở cấu hình bên ngoài.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, docker-compose, fastapi, python
Lĩnh vực
backend, devops
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
15/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.