How to add a python lib to my build?

Article ID:222825768
1 minute readKnowledge base

Issue

I have a pipeline that calls a python script. The python script uses library X to do this. However, X is not installed by default. How do I make it available to my script?

Environment

  • CloudBees Jenkins Enterprise

Resolution

If the source code is available to download you can download it and install it for the current user.

The following examples install the boto3 library for the current user.

Freestyle Project - Shell Step

git clone 'https://github.com/boto/boto3.git'
cd boto3
pip install --user .

Pipeline Project

stage "Install Boto"
git 'https://github.com/boto/boto3.git'
sh 'pip install --user .'