Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

874
Vistas
when i use docker-compose to install a fastapi project, i got AssertionError:

when I use docker-compose to install a fastapi project, I got AssertionError: jinja2 must be installed to use Jinja2Templates

but when I use env to install it, that will be run well.

my OS:

Ubuntu18.04STL

my requirements.txt:

fastapi~=0.68.2
starlette==0.14.2
pydantic~=1.8.1

uvicorn~=0.12.3
SQLAlchemy~=1.4.23

# WSGI
Werkzeug==1.0.1

pyjwt~=1.7.0

# async-exit-stack~=1.0.1
# async-generator~=1.10

jinja2~=2.11.2

# assert aiofiles is not None, "'aiofiles' must be installed to use FileResponse"
aiofiles~=0.6.0
python-multipart~=0.0.5

requests~=2.25.0
pyyaml~=5.3.1
# html-builder==0.0.6
loguru~=0.5.3
apscheduler==3.7.0

pytest~=6.1.2
html2text==2020.1.16
mkdocs==1.2.1

Dockerfile

FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /server
COPY requirements.txt /server/
RUN pip install -r requirements.txt
COPY . /server/

docker-compose.yml

version: '3.7'

services:
  figbox_api:
    build:
        context: .
        dockerfile: Dockerfile
    command:  uvicorn app.main:app --port 8773 --host 0.0.0.0 --reload
    volumes:
    - .:/server
    ports:
    - 8773:8773

Do I need to provide some other information?

Thanks

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I had a same problem on heroku, the error comes from Jinja2 version 2.11.x and it run locally but not in Heroku.

Just install latest version of jinja2 it will work fine in your case too.

pip install Jinja2==3.1.2
or 
pip install Jinja2 --upgrade
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda