[Python] poetry shows as "no such file or directory" in Makefile, but works fine in terminal

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am experimenting with using the CPython C API and managing dependencies (e.g. setuptools) via poetry.

    To compile my code I wrote a Makefile looking something like this:

    PYTHON = poetry run python

    build: setup.py ...some C extension files...
    $(PYTHON) setup.py build_ext
    $(PYTHON) setup.py build_ext -i


    The problem is that when I go to run it, I get this:

    $ make
    poetry run python setup.py build_ext
    make: poetry: No such file or directory
    make: *** [build] Error 1


    Even weirder:

    $ type poetry
    poetry is /Users/rusty/.local/bin/poetry
    $ which poetry
    $ echo $?
    1


    I thought that which and type would return the exact same results.

    I checked my $PATH and it contains the directory ~/.local/bin (not /Users/rusty/.local/bin, literally ~/.local/bin in case that helps) (where pypoetry is installed) twice.

    I am on macOS 15.3.2.

    Please don't give me suggestions like "don't use poetry".

    Continue reading...

Compartilhe esta Página