fzf

raw JSON →
0.72.0 verified Sat May 09 auth: no python

fzf is a general-purpose command-line fuzzy finder. Version 0.72.0 provides a fast and interactive fuzzy search over lists of strings, files, command history, processes, hostnames, bookmarks, git commits, etc. It is typically used as a standalone binary, not imported directly in Python. Release cadence: irregular, approximately 1-2 major versions per year.

pip install fzf-bin
error ModuleNotFoundError: No module named 'fzf'
cause fzf is a binary tool, not a Python importable package.
fix
Use subprocess to call the fzf binary: subprocess.run(['fzf', ...]).
error fzf: --horizontal: unknown option
cause The --horizontal flag was removed in fzf 0.27.0.
fix
Use --layout=reverse-list or other layout option instead of --horizontal.
error Error: fzf: command not found
cause fzf binary is not installed or not in PATH.
fix
Install fzf via your package manager or download from GitHub. For Python, pip install fzf-bin ensures binary is available in PATH.
gotcha fzf-bin installs the fzf binary, not a Python module. You cannot import fzf directly in Python; use subprocess.
fix Use subprocess.run(['fzf', ...]) instead of import fzf.
gotcha Interactive fzf (no --filter) requires a real terminal (tty). In headless environments or subprocess in Python, it may hang or fail.
fix Use --filter for non-interactive filtering, or use pexpect/pyfzf bindings.
deprecated Version 0.20.0 dropped many command-line flags; --no-sort became default behavior. Check old scripts.
fix Update scripts to use new flags; remove deprecated flags like --no-sort (now default).

Use subprocess to invoke the fzf binary. Note that interactive mode requires a tty; for non-interactive use, pipe input and use --filter.

import subprocess
import json

# Example: fuzzy search file names
result = subprocess.run(
    ['fzf', '--filter', 'pattern'],
    input='file1.txt\nfile2.py\nnotes.md\ndocument.pdf',
    capture_output=True,
    text=True
)
print(result.stdout.strip().split('\n'))

# Example: interactive fzf in terminal (requires tty)
# result = subprocess.run(['fzf'], input='...', capture_output=True, text=True)
# print(f'You selected: {result.stdout.strip()}')