Windows - Install Pip Package via Zaz-Pip

Overview

Although pip can be installed into Windows LibreOffice manually, see Windows - Install pip packages into LibreOffice. It is possible to pip install in LibreOffice using an extension. See Install Zaz-Pip LibreOffice Extension.

Another option is to use the Include Python Path for LibreOffice extension to add virtual environment paths to LibreOffice, this would work with all LibreOffice versions after Version 7.0 on all operating systems.

The steps below are the same for portable LibreOffice. See also Windows - Install pip into LibreOffice Portable.

Note

This guide assumes you have already installed LibreOffice.

Anywhere you see <username> it needs to be replaced with your Windows username.

Install Pip

Open Pip manager Tools -> Add Ons -> Open Pip.

If pip is not installed, you will see a dialog like Fig. 1214

Pip Not Installed

Fig. 1214 Pip Not Installed

Click Install PIP and Yes.

Install PIP

Fig. 1215 Install PIP

You may see an warning messages about not being on path as seen in Fig. 1216. These message can be ignored. Pip actually is installed at C:\Users\<username>\AppData\Roaming\Python\Python38\site-packages, where <username> will be your Windows username.

PIP Installed

Fig. 1216 PIP Installed

After Pip is first installed, you may need to restart LibreOffice for it to pick up the new path.

Add a Pip package

We will install ooo-dev-tools package as an example.

Click the Admin PIP button. Type in ooo-dev-tools.

Note

If you have a dark theme like this example, then you may not see the characters when you type them in ( white text on light yellow background). If this is the case, no worries, you can just select the text to see what it typed.

Click Yes to the popup see in Fig. 1217.

Enter Package Name

Fig. 1217 Enter Package Name

Installing in this case did take a bit of time. Be patient and wait to see Successfully installed ... as seen in Fig. 1218.

Enter Package Name

Fig. 1218 Enter Package Name

Testing installed Pip package

ooo-dev-tools has been installed and now we can use it to do a quick test.

Open LibreOffice Writer. Open the APSO console. See also Install APSO LibreOffice Extension.

Add each line to the APSO console, one line at a time followed by the Enter key.

APSO python console [LibreOffice]
3.8.16 (default, Apr 28 2023, 09:24:49) [MSC v.1929 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> from ooodev.loader.lo import Lo
>>> from ooodev.write import WriteDoc
>>>
>>> def say_hello():
...     doc = WriteDoc.from_current_doc()
...     cursor = doc.get_cursor()
...     cursor.append_para(text="Hello World!")
...
>>> say_hello()
>>>

After the line Write.append_para(cursor=cursor, text="Hello World!") is added and the Enter key has been pressed, Hello World! will show up in the Writer document as seen in Fig. 1219. Now we have working pip packages and can add any pip package we need using Zaz-Pip extension.

Hello World!

Fig. 1219 Hello World!