Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using pip in bitbucket pipelines

Steven-Pi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2018

Hey all,

I'd like to use bitbucket pipelines to run a flake8 and coverage check on my code.
I've added the following pipeline config file:

#image: 2.7-jessie

pipelines:
default:
- step:
name: Check PEP8
script:
- apt-get install python-pip -q -y
- pip install flake8
- flake8 --max-line-length=120 --ignore=E402
- step:
name: Check coverage
script:
- apt-get install python-pip -q -y
- pip install coverage, unittest
- python -m coverage run -m unittest discover ./tests/ -v - python -m coverage report -m

 Yet, this pipeline fails when trying to install pip?
I get the following error log:

+ apt-get install python-pip -q -y
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
python-chardet python-chardet-whl python-colorama python-colorama-whl
python-distlib python-distlib-whl python-html5lib python-html5lib-whl
python-pip-whl python-pkg-resources python-requests python-requests-whl
python-setuptools python-setuptools-whl python-six python-six-whl
python-urllib3 python-urllib3-whl python-wheel python3-pkg-resources
Suggested packages:
python-genshi python-lxml python-distribute python-distribute-doc
python3-setuptools
Recommended packages:
python-dev-all
The following NEW packages will be installed:
python-chardet python-chardet-whl python-colorama python-colorama-whl
python-distlib python-distlib-whl python-html5lib python-html5lib-whl
python-pip python-pip-whl python-pkg-resources python-requests
python-requests-whl python-setuptools python-setuptools-whl python-six
python-six-whl python-urllib3 python-urllib3-whl python-wheel
python3-pkg-resources
0 upgraded, 21 newly installed, 0 to remove and 18 not upgraded.
Need to get 1973 kB of archives.
After this operation, 5589 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main python-chardet all 2.0.1-2build2 [106 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python3-pkg-resources all 3.3-1ubuntu2 [31.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-chardet-whl all 2.2.1-2~ubuntu1 [170 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-colorama all 0.2.5-0.1ubuntu2 [18.4 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-colorama-whl all 0.2.5-0.1ubuntu2 [18.2 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-distlib all 0.1.8-1ubuntu1 [113 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-distlib-whl all 0.1.8-1ubuntu1 [140 kB]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-six all 1.5.2-1ubuntu1
404 Not Found [IP: 91.189.88.161 80]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-html5lib all 0.999-3~ubuntu1 [83.5 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-html5lib-whl all 0.999-3~ubuntu1 [109 kB]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-six-whl all 1.5.2-1ubuntu1
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-urllib3-whl all 1.7.1-1ubuntu4
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-requests-whl all 2.2.1-1ubuntu0.3
404 Not Found [IP: 91.189.88.161 80]
Get:10 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-setuptools-whl all 3.3-1ubuntu2 [244 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-pip-whl all 1.5.4-1ubuntu4 [111 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-pkg-resources all 3.3-1ubuntu2 [61.9 kB]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-urllib3 all 1.7.1-1ubuntu4
404 Not Found [IP: 91.189.88.161 80]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-requests all 2.2.1-1ubuntu0.3
404 Not Found [IP: 91.189.88.161 80]
Get:13 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-setuptools all 3.3-1ubuntu2 [230 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe python-pip all 1.5.4-1ubuntu4 [97.3 kB]
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-wheel all 0.24.0-1~ubuntu1
404 Not Found [IP: 91.189.88.161 80]
Fetched 1535 kB in 2s (701 kB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/six/python-six_1.5.2-1ubuntu1_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/six/python-six-whl_1.5.2-1ubuntu1_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python-urllib3/python-urllib3-whl_1.7.1-1ubuntu4_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/requests/python-requests-whl_2.2.1-1ubuntu0.3_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python-urllib3/python-urllib3_1.7.1-1ubuntu4_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/requests/python-requests_2.2.1-1ubuntu0.3_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/w/wheel/python-wheel_0.24.0-1~ubuntu1_all.deb 404 Not Found [IP: 91.189.88.161 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

 I tried not installing pip and relying on pip in the 2.7-jessie image, but that gives me the following error:

+ pip install flake8bash: pip: command not found

 
Any idea what I am doing wrong? Thanks for the assistance.

1 answer

1 accepted

2 votes
Answer accepted
Jeroen De Raedt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2018

Hi @Steven-Pi,

as the log suggests, maybe try running 

apt-get update  

 This might update outdated dependencies first. 

Steven-Pi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 20, 2018

Ah, of course. This worked for me. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events