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

Building a Python project using Pants on Bitbucket Pipelines

kf Fellows January 8, 2018

I'm currently attempting to build a Python project using Pants. However, when I try to create my PEX files, I get the following error:

 **** Failed to install apache-beam-2.2.0 (caused by: NonZeroExit("received exit code 1 during execution of `[u'/usr/bin/python2.7', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpnnAmyB']` while trying to execute `[u'/usr/bin/python2.7', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpnnAmyB']`",)):

stdout:

stderr:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "setup.py", line 61, in <module>
_PIP_VERSION = get_distribution('pip').version
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 553, in get_distribution
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 427, in get_provider
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 963, in require
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 849, in resolve
pkg_resources.DistributionNotFound: The 'pip' distribution was not found and is required by the application


Invalidated 4 targets.
21:51:56 00:09 [complete]
Exception caught: (<class 'pex.resolver.Untranslateable'>)

Exception message: Package SourcePackage(u'file:///opt/atlassian/pipelines/agent/build/.pants.d/python-setup/resolved_requirements/CPython-2.7.9/apache-beam-2.2.0.zip') is not translateable by ChainedTranslator(WheelTranslator, EggTranslator, SourceTranslator)

FAILURE

I have tried to replicate the issue by following the "Debug your pipelines locally with Docker" article, but everything works fine; it's only when I'm trying to use Bitbucket Pipelines that I get this error message.

Here are the contents of my `bitbucket-pipelines.yml`, as well:

image: python:2.7

pipelines:
branches:
  staging:
    - step:
      name: Create PEX files for all tasks
      script:
        - pip install pantsbuild.pants==1.3.0
        - for dir in src/python/*/; do pants binary ${dir}tasks::; done
      artifacts:
        - dist/*

Any insight into how I can debug?

1 answer

0 votes
Jeroen De Raedt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2018

Hey,

it looks like pip is not installed. 

Could you run `sudo easy_install pip` or if you are using python 2.6 `sudo easy_install_2.6 pip` ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events