[Python] uv run fails with "failed to spawn"

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have a module with a pretty regular layout, a main function in a sacrypt directory inside a __init__.py file. Then, pyproject.toml looks like this;

    [project]
    name = "sacrypt"
    version = "0.1.0"
    description = "Cryptanalysis examples for SAC"
    readme = "README.md"
    requires-python = ">=3.13"

    [project.scripts]
    sacrypt = "sacrypt:main"


    uv run sacrypt, however, fails with:

    error: Failed to spawn: `sacrypt`
    Caused by: No such file or directory (os error 2)


    I have tried changing it to a different name, as well as moving sacrypt to src/sacrypt to no avail. This is by the book following tutorials as well as the documentation. Any idea what is going on here or where I should poke to find the error? Running uv with any amount of -v is not giving any more information. Also, this is uv version 0.6.9.

    Update: As instructed in the comment, I have added a build system this way

    [build-system]
    requires = ["setuptools>=42", "wheel"]
    build-backend = "setuptools.build_meta"


    And then issued uv build. Still an error, this time different:

    Traceback (most recent call last):
    File "/home/jmerelo/Tutoriales/cemed-green-software/code/Python/.venv/bin/sacrypt", line 4, in <module>
    from sacrypt import main
    ModuleNotFoundError: No module named 'sacrypt'


    Running it from the command line, or running tests, works fine.

    Continue reading...

Compartilhe esta Página