Skip to main content

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, pyppeteer uses a Chromium headless browser to take static screenshots of interactive elements of your project.

Note that right after you install pyppeteer then you want to run

pyppeteer-install

one time only. This will install a Chromium browser where it should only be available to this package. If you already have a Chrome browser installed, then you are suppose to be able to configure pyppeteer to use that instead. But we have not tried that yet, so please let us know how to do it.

Table C.3.1. PIP-installable Python Packages
Package Purpose
lxml

XSL processing

requests

Communication with online servers

pdfCropMargins

Crop images during production

pyppeteer

Automatic screenshots of interactive elements