Install Third-party libraries

Hi @Sao,

If you are comfortable with docker, you can make a version of Grist with extra python libraries as follows. Make an empty directory, and in it create a file called Dockerfile containing the following:

FROM gristlabs/grist

RUN \
  apt update && apt install -y openssl && \
  python3 -m pip install Jinja2

Then build a docker image from this using the docker command:

docker build -t paulfitz/grist .

(I’m calling the image paulfitz/grist but you could call it what you like). If all goes well, you should see a lot of lines about installation, including:

Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.1

Edited to add: in newer versions of docker, you may need to explicitly ask to see build steps:

docker build --progress=plain --no-cache -t paulfitz/grist .

Now you can do a quick test of the result by starting a container from your new image:

docker run -p 8484:8484 -it paulfitz/grist

You should see a Welcome to Grist message and other lines about how Grist is set up. Now if you go to your browser and visit:

http://localhost:8484

You should see an empty Grist installation. Click Create Empty Document and stick this formula in a cell:

import jinja2
jinja2.__version__

All going well the cell should show something like 3.1.2 (that’s what it did for me), showing that Jinja is now available.

If you are using docker compose, then all you need to do now is get your image to wherever you are running Grist, and swap it in for gristlabs/grist. Let me know if you need help with that step.

Good luck! :smiley:

2 Likes