Hi Folks. I am trying to build pex for the followi...
# general
n
Hi Folks. I am trying to build pex for the following
Copy code
pex_binary(
    name="pex_binary",
    entry_point="zookeeper_jmx.py",
    shebang='/usr/bin/env python3',
    platforms=[
        'linux_x86_64-cp-38-cp38',
        'linux-aarch64-cp-38-cp38',
    ],
)
I have third party dependency
Copy code
JPype1==0.6.3
I have created the following wheels
Copy code
JPype1-0.6.3-cp38-cp38-linux_aarch64.whl
JPype1-0.6.3-cp38-cp38-linux_x86_64.whl
and provided the following pants.toml config
Copy code
[python-repos]
# No one needs to change these values, as long as they can use the same shared location.
find_links = ["file://%(buildroot)s/wheelhouse"]
path_mappings = ["WHEELS_DIR|%(buildroot)s/wheelhouse"]
I still see messages like
Copy code
0:32:54.89 [WARN] Pants cannot infer owners for the following imports in the target collectors/lib/zookeeper_jmx/libs/jmx_helper/jmx_helper.py:lib:

  * jpype (line: 4)
  * jpype.javax (line: 5)
This works for other libraries though when pantsbuild is able to use the wheel for both the patforms. The only difference is the other library wheels are in the following format which has
py3-none-any
format.
Copy code
statsd-1.6.7-py3-none-any.whl
Thanks
1
b
That message usually shows up because Pants cannot figure out which dependency provides the
jpype
import. To fix that, you’ll need to add a
module_mapping
to wherever your requirements are defined: https://www.pantsbuild.org/2.22/reference/targets/python_requirements#module_mapping Your mapping would need to contain something like
"JPype1": ["jpype"]
n
Thanks. It worked. Appreciate your help.
👍 1