Skip to content

Use UV as a faster pip implementation#2556

Open
Arusekk wants to merge 3 commits into
Gallopsled:devfrom
Arusekk:uv
Open

Use UV as a faster pip implementation#2556
Arusekk wants to merge 3 commits into
Gallopsled:devfrom
Arusekk:uv

Conversation

@Arusekk

@Arusekk Arusekk commented Feb 28, 2025

Copy link
Copy Markdown
Member

Closes #2490

@Arusekk

Arusekk commented Mar 3, 2025

Copy link
Copy Markdown
Member Author

Okay: for some reason this breaks PLT emulation (so unicorn?), breaks it consistently, and only breaks it on py3.10.

Why? No idea yet.

@Arusekk

Arusekk commented Mar 3, 2025

Copy link
Copy Markdown
Member Author
>>> import unicorn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.venv/lib/python3.10/site-packages/unicorn/__init__.py", line 4, in <module>
    from .unicorn import Uc, ucsubclass, uc_version, uc_arch_supported, version_bind, debug, UcError, __version__
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn.py", line 14, in <module>
    from .unicorn_py3 import *
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/__init__.py", line 1, in <module>
    from .unicorn import *
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/unicorn.py", line 236, in <module>
    uclib = __load_uc_lib()
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/unicorn.py", line 123, in __load_uc_lib
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Arusekk added a commit to Arusekk/unicorn that referenced this pull request Mar 3, 2025
Previous logic required old setuptools on py3.8 up to py3.11.
So if new setuptools was installed, importing unicorn always failed with
ImportError on these Python versions.

It now tries to use old setuptools on py3.8, but falls back gracefully
to not using anything.
So it works on py3.9+ fully, and on py3.8 it also works but with more
limited path discovery (I think it is enough, since no one complained
yet).

Fixes: 0c34496 ("Modify canonicals import")
Ref: unicorn-engine@0c34496
Ref: Gallopsled/pwntools#2556
@Arusekk

Arusekk commented Mar 3, 2025

Copy link
Copy Markdown
Member Author

Okay, this is a thing probably on Unicorn's side: unicorn-engine/unicorn#2122

@Arusekk

Arusekk commented Mar 3, 2025

Copy link
Copy Markdown
Member Author

Huh?

https://github.com/astral-sh/uv/blob/83f1b8b0f13713f2413ae9b96c64da0cedcf5fb8/crates/uv/src/commands/venv.rs#L354-L365

        // Resolve the seed packages.
        let requirements = if interpreter.python_tuple() >= (3, 12) {
            vec![Requirement::from(
                uv_pep508::Requirement::from_str("pip").unwrap(),
            )]
        } else {
            // Include `setuptools` and `wheel` on Python <3.12.
            vec![
                Requirement::from(uv_pep508::Requirement::from_str("pip").unwrap()),
                Requirement::from(uv_pep508::Requirement::from_str("setuptools").unwrap()),
                Requirement::from(uv_pep508::Requirement::from_str("wheel").unwrap()),
            ]
        };

It seems venv does seed itself, but not venv-less things.

@Arusekk

Arusekk commented Mar 24, 2025

Copy link
Copy Markdown
Member Author

Blocked: waiting for Unicorn 2.1.4.

@cclauss

cclauss commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Please fix git conflicts.

Comment thread .github/workflows/ci.yml Outdated
@Arusekk Arusekk force-pushed the uv branch 3 times, most recently from f775976 to 4b92fa4 Compare November 6, 2025 08:57
@Arusekk

Arusekk commented Nov 6, 2025

Copy link
Copy Markdown
Member Author

Note setup-uv@v6 brought a usability impairment (astral-sh/setup-uv#381).

@Arusekk Arusekk added blocked and removed blocked labels Nov 6, 2025
@Arusekk

Arusekk commented Nov 6, 2025

Copy link
Copy Markdown
Member Author

Nope, still blocked, waiting for unicorn 2.1.5 (2.1.4 has broken MIPS).

@cclauss

cclauss commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

ModuleNotFoundError: No module named 'pkg_resources'

Some of the pkg_resources code is still available in modern setuptools.
% uvx --with=unicorn python3.14 -c 'import unicorn'
% uvx --with=setuptools,unicorn python3.14 -c 'import unicorn'

@peace-maker

Copy link
Copy Markdown
Member

We should consider softening our unicorn 2.1.4 ban and maybe allow it and just add a temporary warning when emulating MIPS PLT. There are annoying consequences when installing pwntools on Python 3.14 due to missing unicorn binary wheels.

Then we could switch to uv too or are there other blockers still @Arusekk?

@peace-maker

Copy link
Copy Markdown
Member

See #2721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate UV for installation etc speedup

3 participants