Validated PEX build fails because of missing dependency with this workaround:
$ echo setuptools > pulp_cli.req $ pex -r pulp_cli.req -v -c pulp -o pulp.pex 'pulp-cli[pygments]' $ deactivate $ ./pulp.pex --version pulp3 command line interface, version 0.12.0 ср, 15 дек. 2021 г. в 12:43, Konstantin M. Khankin < [email protected]>: > Hello! > > I wanted to make pulp-cli portable and build PEX archive out of it but the > latest pex (2.1.56) fails to do so: > > ``` > $ pex -v -c pulp 'pulp-cli[pygments]' > ... > Running PEX file at /tmp/tmpdy35exye with args [] > pex: PEX.run invoking /home/hc/pex/bin/python3 -s -E /tmp/tmpdy35exye > pex: Re-executing: cmdline='/usr/bin/python3.10 /tmp/tmpdy35exye', > sys.executable='/home/hc/pex/bin/python3', PEX_PYTHON=None, > PEX_PYTHON_PATH=None, interpreter_constraints=[] > pex: Found site-library: /usr/local/lib/python3.10/site-packages > pex: Found site-library: /usr/lib/python3.10/site-packages > pex: Found site-library: /usr/local/lib64/python3.10/site-packages > pex: Found site-library: /usr/lib64/python3.10/site-packages > pex: Tainted path element: /usr/lib64/python3.10/site-packages > pex: Tainted path element: /usr/lib/python3.10/site-packages > pex: Scrubbing from user site: /home/hc/.local/lib/python3.10/site-packages > pex: Scrubbing from site-packages: /usr/lib64/python3.10/site-packages > pex: Scrubbing from site-packages: /usr/lib/python3.10/site-packages > pex: New sys.path: ['/tmp/tmpdy35exye/.bootstrap', '/tmp/tmpdy35exye', > '/usr/lib64/python310.zip', '/usr/lib64/python3.10', > '/usr/lib64/python3.10/lib-dynload'] > pex: Activating PEX virtual environment from /tmp/tmpdy35exye: 54.7ms > pex: Bootstrap complete, performing final sys.path modifications... > pex: PYTHONPATH contains: > pex: /tmp/tmpdy35exye > pex: * /usr/lib64/python310.zip > pex: /usr/lib64/python3.10 > pex: /usr/lib64/python3.10/lib-dynload > pex: > /home/hc/.pex/installed_wheels/7679cb4a5378680b93c1f33b463094a55cf8c547/pulp_cli-0.12.0-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/23fff3a23c744ec73d03f9639bec17d3745b762c/click-8.0.3-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/bc1215388f22b27f973bc1bc3d74a96373404ac9/packaging-21.3-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/33b6478f39bfd332868d887340fd44164373dfb4/pyparsing-3.0.6-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/5aa8517e7212729e4c0b95fab8b765c01e48f97c/PyYAML-5.4.1-cp310-cp310-linux_x86_64.whl > pex: > /home/hc/.pex/installed_wheels/cd6d3dfd86e52a31a3664cff69214a5dd94161e7/schema-0.7.4-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/c29688d87604522b7f9aa8a178a6a21b6a9fe775/contextlib2-21.6.0-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/d20e2df000dd43249c3a9eed041f08a812a93423/requests-2.26.0-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/601e0a29cd7d663eb8ea40c3ba7a52200e2544c0/urllib3-1.26.7-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/883fca1b3199ac78822a54c4af0a01c1f7a7ea74/certifi-2021.10.8-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/7e4deb9e3d26e447cfdd8c00b13805d8d2a65fca/charset_normalizer-2.0.9-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/5485a373e7aae71ef1d2c02b8b09c330b75c5248/idna-3.3-py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/a55ae166e643e6c7a28c16fe005efc32ee98ee76/toml-0.10.2-py2.py3-none-any.whl > pex: > /home/hc/.pex/installed_wheels/8dd8170137ab3f4dc94d5006227635731b451dd1/Pygments-2.10.0-py3-none-any.whl > pex: /tmp/tmpdy35exye/.bootstrap > pex: * - paths that do not exist or will be imported via zipimport > Traceback (most recent call last): > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 476, in execute > exit_value = self._wrap_coverage(self._wrap_profiling, self._execute) > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 401, in > _wrap_coverage > return runner(*args) > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 432, in > _wrap_profiling > return runner(*args) > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 532, in _execute > return self.execute_entry(self._pex_info.entry_point) > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 668, in execute_entry > return self.execute_pkg_resources(entry_point) > File "/tmp/tmpdy35exye/.bootstrap/pex/pex.py", line 699, in > execute_pkg_resources > runner = entry.resolve() > File > "/tmp/tmpdy35exye/.bootstrap/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py", > line 2481, in resolve > module = __import__(self.module_name, fromlist=['__name__'], level=0) > File > "/home/hc/.pex/installed_wheels/7679cb4a5378680b93c1f33b463094a55cf8c547/pulp_cli-0.12.0-py3-none-any.whl/pulpcore/cli/common/__init__.py", > line 7, in <module> > import pkg_resources > ModuleNotFoundError: No module named 'pkg_resources' > ``` > > As I understand, this happens because setup.py does not > <https://github.com/pulp/pulp-cli/blob/cfa096774946c0d0100d5263fa65f5b251a8c566/setup.py#L47> > explicitly declare a dependency on setuptools (which contains pkg_resources > unlike the packaging lib). If that's correct, could you add the dependency > please? If not, do you know what can be the issue here? > > Also, it seems to me pkg_resources is only used to load CLI plugins here > <https://github.com/pulp/pulp-cli/blob/cfa096774946c0d0100d5263fa65f5b251a8c566/pulpcore/cli/common/__init__.py#L163>. > However, the document which this code mentions does not include any > mentions of pkg_resources. Can it be that a better fix here is to update > the plugin loading function? > > Thanks! > > -- > Konstantin Khankin > -- Ханкин Константин
_______________________________________________ Pulp-list mailing list [email protected] https://listman.redhat.com/mailman/listinfo/pulp-list
