web analytics
Skip to main content

The PreTeXt Guide

Section C.3 PIP Install

PIP, in the open source tradition of recursive acronyms, stands for “PIP Installs Packages”. This package manager helps you obtain software and keep it up-to-date. There are three packages that are indispensable for use with PreTeXt so you can practice doing installations now via your virtual environment.
In your virtual environment, go
(ptx) $ pip install lxml
Now you have a collection of Python routines that interface with the same base libraries for XSL processing as the xsltproc executable. A second library is requests which moderates communications with online servers and is necessary to communicate with WeBWorK servers and with a YouTube server that provides thumbnail images for static versions of videos. The pdfCropMargins package provides a tool that will crop images during their production with the pretext script. Finally, playwright uses a Chromium headless browser to take static screenshots of interactive elements of your project.
Note that right after you install playwright then you want to run
 playwright install
one time only. This will install three web browsers (Chromium, Firefox, WebKit) and FFMPEG where they should only be available to this package.
Table C.3.1. PIP-installable Python Packages
Package Purpose
lxml
XSL processing
requests
Communication with online servers
pdfCropMargins
Crop images during production
playwright
Automatic screenshots of interactive elements