3

I have a local jenkinsserver thats running on http://localhost:8080 in my personal MAC machine.

Now, I have created a sample Jenkinsfile and trying to run through Jenkins job.

 stage ('Install_Requirements') {
            steps {
                sh """
                    echo ${SHELL}
                    [ -d venv ] && rm -rf venv
                    #virtualenv --python=python2.7 venv
                    virtualenv venv
                    #. venv/bin/activate
                    export PATH=${VIRTUAL_ENV}/bin:${PATH}
                    pip install --upgrade pip
                    pip install -r requirements.txt -r dev-requirements.txt
                    make clean
                """
            }
        }

There are multiple stages in the projects but when I execute this 'Install_Requirements' stage I get a error :-

[python-jenkinsfile-testing] Running shell script
+ echo /bin/bash
/bin/bash
+ '[' -d venv ']'
+ virtualenv venv
/Users/Shared/Jenkins/Home/workspace/python-jenkinsfile-testing@tmp/durable-4363725f/script.sh: line 6: virtualenv: command not found

When I try to execute virtualenv venv command on my terminal it creates the venv and I'm also able to activate the environment.

Not sure why I get this error.

user1050619
  • 19,822
  • 85
  • 237
  • 413
  • The path is probably not set properly on your node. You can verify by running ` sh script: 'echo $PATH'` [This](https://stackoverflow.com/questions/15620369/jenkins-on-mac-path-is-not-set-right-no-usr-local-bin) explains how you can fix the path config. – Vasiliki Siakka May 31 '18 at 14:06

0 Answers0