Jenkins build failure for python script in github

I created a simple python code in my github repo with the following:

import numpy as np
import matplotlib as plt
a=np.arange(1,5).reshape(4,1)
print(a)
print(a.data)
print(a**2)
print(a.dtype)

I integrated my GitHub with Jenkins.

I build a job with freestyle project name it project1.

I put my repo url in the scm and my credential.

I used build trigger as GitHub hook.

In the build step I used shell script

python3 numpy.py

saved it and when trying to build it shows failure

saying no module matplotlib and NumPy something like this.

Why I am not able to build it.

What should I write in the execution shell?

Hi @Biswajit-Patnaik ,

You need to install the dependencies numpy and matplotlib before run the python script

For that you’ve two options :

  • Add the following command :
pip3 install numpy
pip3 install matplotlib
  • or you can create a requirements.txt file and add the requirements
numpy
matplotlib

then install them

pip3 install -r requirements.txt

Regard