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 .'
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.