Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use pip inside jenkins

I am trying to create a virtualenv inside jenkins job and then install requirements.txt. But I am unable to create virtualenv. This is what my Jenkins file look like.

sh 'sudo easy_install pip; pip install virtualenv'

But I am getting

+ sudo easy_install pip
Searching for pip
Best match: pip 9.0.1
Processing pip-9.0.1-py2.7.egg
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
+ pip install virtualenv
/Users/Shared/Jenkins/Home/workspace/test-jenkinsfile@tmp/durable-e0a93859/script.sh: line 3: pip: command not found
like image 430
reetesh11 Avatar asked Jun 19 '17 11:06

reetesh11


1 Answers

The pip command cannot be found within the user's path. the solution is either call it directly from /usr/local/bin/pip or add /usr/local/bin to the user's path

for bash: PATH=${PATH}:/usr/local/bin

for (t)csh: setenv PATH "${PATH}:/usr/local/bin"

like image 151
Tamar Avatar answered Sep 22 '22 22:09

Tamar