JoshData / JoshData/python-email-validator
:bug: ImportError: email-validator is not installed using Docker, Pydantic and Kool
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 1.4k
- Forks
- 140
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
L’issue inclut requirements.txt, Dockerfile, docker-compose.yml et kool.yml, mais aucun fichier du dépôt, point d’entrée ou test n’est indiqué. Reproduisez la construction du conteneur à partir de ces configurations et inspectez les paquets installés ainsi que l’environnement d’importation. Le travail est terminé lorsqu’une correction précise au niveau du projet est identifiée ou qu’il est confirmé que le problème vient d’une configuration externe.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- docker, docker-compose, fastapi, python
- Domaine
- backend, devops
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 15/100