On Feb 24, 2015 9:33 AM, "Mike Cripps (Football Radar)" <mike....@footballradar.com> wrote:
>
> Hi Pants folks
>
> We're attempting to build a .pex so we can execute it in our production environment. We are currently building the pex on an OS X machine, and deploying to Ubuntu Linux.
>
> When we copy (scp) the pex to the remote machine and attempt to run it, we get the following error:
>
> Traceback (most recent call last):
> File "/home/ubuntu/cron.pex/.bootstrap/_pex/pex.py", line 263, in execute
> working_set = self._env.activate()
> File "/home/ubuntu/cron.pex/.bootstrap/_pex/environment.py", line 123, in activate
> self._working_set = self._activate()
> File "/home/ubuntu/cron.pex/.bootstrap/_pex/environment.py", line 141, in _activate
> resolved = working_set.resolve(all_reqs, env=self)
> File "/home/ubuntu/cron.pex/.bootstrap/pkg_resources.py", line 639, in resolve
> raise DistributionNotFound(req)
> DistributionNotFound: thrift
>
> However '//3rdparty/python:thrift' is clearly marked as a dependency of our python_library. We thought that perhaps this is because we didn't specify the 'platforms' in the python_binary and so we did that as follows:
>
> platforms = ['current', 'linux-x86_64'],
From my phone so this is terse, but you're on the right track here. The remaining issue is pants has no magic for creating linux platform specific bdists on osx - it can't. Unfortunately the error message is a bit obtuse.
You need to have pre-built linux bdists available in some repo and add this repo to your pants.ini. Pantsbuild has this set up for its own cross platform pex builds (it uses psutil for example). See this enabling section in pants.ini: https://github.com/pantsbuild/pants/blob/master/pants.ini#L174
The repos key needs to have an urgent pointing to a flat directory of prebuilt bdists and the indices line is important so that pants falls back to searching pypi for everything else.
And it's easy to check if you've got this setup right before deploying - just list the pex (it's a zip file) and confirm there are 2 bdists for each platform specific dep /in .deps/). You should see an osx _and_ a linux egg for thrift.