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

0 vote

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,452 views 26 12
Join discussion

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