Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zipapp for pipx 1.7.0 is missing tomli #1514

Closed
maxwell-k opened this issue Aug 23, 2024 · 1 comment · Fixed by #1515
Closed

zipapp for pipx 1.7.0 is missing tomli #1514

maxwell-k opened this issue Aug 23, 2024 · 1 comment · Fixed by #1515
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@maxwell-k
Copy link
Contributor

Describe the bug

When I run the zippapp for 1.7.0 using Python 3.10 I obtain a ModuleNotFoundError: No module named 'tomli'.

From this earlier issue which was addressed in this pull request, I understand that the tomli library must be included in the zipapp to support Python < 3.11. Further I understand that if the zipapp is built using Python 3.11 or later, then tomli will not be included.

The zipapp artifact uploaded by this CI job is not affected. Is it possible that the zippapp uploaded to the 1.7.0 release was built using Python 3.11 or later?

Is it possible to release a new zipapp that includes the tomli library please?

How to reproduce

Checking zipapp contents

The easiest way to check the contents is to download the zipapp and extract it:

curl --location --remote-name https://github.com/pypa/pipx/releases/download/1.7.0/pipx.pyz \
&& unzip pipx.pyz

Then note the absence of site_packages/tomli.

For example compare to the previous release:

curl --location --remote-name https://github.com/pypa/pipx/releases/download/1.6.0/pipx.pyz \
&& unzip pipx.pyz
Reproducing the traceback
Commands to reproduce trace back:

    curl --silent --location --remote-name https://github.com/pypa/pipx/releases/download/1.7.0/pipx.pyz \
    && python3.10 pipx.pyz

Output:

    Traceback (most recent call last):
      File "/home/maxwell-k/Downloads/pipx.pyz/_bootstrap/__init__.py", line 76, in import_string
      File "/home/maxwell-k/.shiv/pipx.pyz_470623b0abb5f46e0cef98e1443fd9cf54f230ecdd5399e59dfd8163372499e1/site-packages/pipx/main.py", line 22, in <module>
        from pipx import commands, constants, paths
      File "/home/maxwell-k/.shiv/pipx.pyz_470623b0abb5f46e0cef98e1443fd9cf54f230ecdd5399e59dfd8163372499e1/site-packages/pipx/commands/__init__.py", line 9, in <module>
        from pipx.commands.run import run
      File "/home/maxwell-k/.shiv/pipx.pyz_470623b0abb5f46e0cef98e1443fd9cf54f230ecdd5399e59dfd8163372499e1/site-packages/pipx/commands/run.py", line 30, in <module>
        import tomli as tomllib
    ModuleNotFoundError: No module named 'tomli'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/maxwell-k/Downloads/pipx.pyz/_bootstrap/__init__.py", line 84, in import_string
    AttributeError: module 'pipx' has no attribute 'main'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/maxwell-k/Downloads/pipx.pyz/__main__.py", line 3, in <module>
      File "/home/maxwell-k/Downloads/pipx.pyz/_bootstrap/__init__.py", line 253, in bootstrap
      File "/home/maxwell-k/Downloads/pipx.pyz/_bootstrap/__init__.py", line 81, in import_string
      File "/home/maxwell-k/Downloads/pipx.pyz/_bootstrap/__init__.py", line 87, in import_string
    ImportError: module 'pipx' has no attribute 'main'

Expected behavior

I expect the zipapp to include tomli so that it is functional with Python 3.10.

@Gitznik Gitznik added the bug Something isn't working label Aug 23, 2024
@Gitznik
Copy link
Contributor

Gitznik commented Aug 23, 2024

It was built with python3.12 it seems: https://github.com/pypa/pipx/actions/runs/10510319883/job/29118690537?pr=1511
PR to fix this is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants