Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pip not found when using pipeline even image is specified

JordenChang February 2, 2020

I use pipeline to deploy my product for couple of months and it works pretty well.

But it suddenly failed when I tried to deploy new version today.

In pipeline console it shows this error

 

 

bash: pip: command not found

However, I have not modified the configuration for a long time.

My configuration is like this:

image: python:2.7

pipelines:
tags:
'*':
- step:
name: Deploy to GAE
deployment: production
image: google/cloud-sdk:latest
script:
- cd apps
- echo "Starting to deploy ${BITBUCKET_TAG} to GAE"
- pip --quiet install -r requirements.txt -t lib/
- pipe: atlassian/google-app-engine-deploy:0.4.1
variables:
KEY_FILE: $GCLOUD_API_KEYFILE
PROJECT: $GCLOUD_PROJECT
VERSION: $(echo $BITBUCKET_TAG | tr '.' '-')

 

 

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 2, 2020

Hello @JordenChang,

So your script is running in google/cloud-sdk:latest Docker image, as defined in step.image attribute. This image indeed has no pip, however it has pip3, here's what I got when I tried that image locally:

$ docker run -it --rm google/cloud-sdk:latest
Unable to find image 'google/cloud-sdk:latest' locally
latest: Pulling from google/cloud-sdk
8f0fdd3eaac0: Pull complete
e8ad95c8aeec: Pull complete
5d3194bbea4a: Pull complete
Digest: sha256:02041df1f597b8e4f1f2b993e8990f2011c01c61e25f5ff99a604753a166ac82
Status: Downloaded newer image for google/cloud-sdk:latest
root@9000cf15c10a:/# pip -V
bash: pip: command not found
root@9000cf15c10a:/# pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

Looking at the relevant repository commit history, I can see they've updated to Python 3 recently. Although it is possible to alias pip to pip3, it hasn't been done for that image.

Since your Pipelines configuration depends on the latest tag of that image, the pipeline you ran pulled the latest version with the changes I mentioned. This is why that pipeline suddenly stopped working.

A work around would be to switch to pip3 instead of pip in your script. I'd also check that your code is compatible with Python 3.7, if this is relevant.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events