Building a Python project using Pants on Bitbucket Pipelines Edited

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

This widget could not be displayed.

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
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,317 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you