Fix Jinja2 error in Docker getting started Tutorial

A Docker build fails with AttributeError: module 'Jinja2' has no attribute 'contextfilter' when running MkDocs. The fix is pinning Jinja2 to version 3.0.3 in requirements.txt, then rebuilding.
Chapters
Alright, so I'm going through this Docker Getting Started tutorial here, and I'm running into a problem, and I'll simulate it here so you can see. So I've gone through the clone portion, I'm going through the build right now, and I keep getting this error. Error build 2 out of 2 run mkdocs. So I'm getting an error with mkdocs build. And the error it's giving me here, it's attribute error, and it's module Jinja2 has no attribute context filter. So after looking this up, doing some research, I found this on MKDocs GitHub repo, and it's already one of the issues that's already been closed. And I found a solution down here, somebody by the name of Frankie567. He's the one that kind of provided a solution here, and it seems to work for other people. So I'll demonstrate how you can do this as well on your part and get it. So this is where I saved, um, this is my file too. And how to access this requirements file here, uh, you go to where you downloaded your— let's go here— go where you downloaded your— where you cloned your repo, which for me it's here, Getting Started repo right here. And you go down and look for requirements. You'll find the requirements.txt file here. You click on it, which is— it's going to open up. And once you have it here, all you have to do is add this line right here that this guy just mentioned, uh, add Jinja2 under the requirements. So we add Jinja2 version 3.0.3 and save. Ctrl+Save, or you can do File and then Save. Then once we've done that, go back to Docker and let's rerun this again and see if we get a— if this one goes through. So, all right, so it should go through now that we've updated the requirements with the Jinja version that we wanted to. So apparently it seems that they just updated, uh, Jinja version and it doesn't really account for the, for the previous one of how this tutorial is built. So Changing that should be able to get this to pass. So just a few minutes— seconds, I mean. Okay, seems we're good now. So if you look down here, it says, you know, everything seems to, you know, finished already. So we're good to go. So if you have this problem, I would suggest just going again to your requirements file and adding this Jinja2 version here and rerun it again. 3.0. Uh, 0.3. And rerun it and should be good to go. All right, cool.
More from Tony

Summarize Videos and Research Companies with CrewAI + Gemini Models [Quickstart Guide]

How to Make Your AI Agents More Reliable with CrewAI Task Guardrails (Step-by-Step Tutorial)








