Pip install not working with jenkins? Pip install not working with jenkins? jenkins jenkins

Pip install not working with jenkins?


As tftd wrote, change HOME to writable directory like:

pipeline {    agent none    stages {        stage('Build') {            agent {                docker {                    image 'python:3-alpine'                }            }            steps {                withEnv(["HOME=${env.WORKSPACE}"]) {                    sh 'pip install --user -r requirements.txt'                    sh 'python WebChecker.py'                }            }            post {                always {                    junit 'output.xml'                }            }        }    }}


You need to add virtualenv to PATH variable.

If you installed it using pip install virtualenv, it will be in pythonX.X/Lib/site-packages/

Sudo should also be added to PATH variable.


The error in first code snippet is because you did not have permissions to write to '/.local'. Try running it as administrator


Try to add argument -u root:root like this:

withDockerContainer(image: 'python:3.6', args:'-u root:root'){        sh """            pip install --user -r requirements.txt            python WebChecker.py        """    }