Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

875
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!