{"id":2072,"library":"inquirer","title":"Python Inquirer","description":"Inquirer is a Python library that provides a collection of common interactive command-line user interfaces, based on the popular Inquirer.js. It aims to simplify asking questions, parsing and validating answers, and managing hierarchical prompts in CLI applications. The library is actively maintained and receives regular updates, with the current version being 3.4.1.","status":"active","version":"3.4.1","language":"python","source_language":"en","source_url":"https://github.com/magmax/python-inquirer","tags":["cli","interactive","prompt","user interface"],"install":[{"cmd":"pip install inquirer","lang":"bash"}],"dependencies":[{"reason":"Requires Python 3.9.2 or higher.","package":"python","optional":false},{"reason":"Improved Unicode support on Windows, especially from v3.4.0 onwards.","package":"readchar","optional":false}],"imports":[{"note":"The main entry point for creating and prompting questions.","symbol":"inquirer","correct":"import inquirer"},{"note":"The function used to display prompts and collect answers.","symbol":"inquirer.prompt","correct":"import inquirer\nanswers = inquirer.prompt(questions)"},{"note":"This registry entry refers to the `inquirer` library (magmax/python-inquirer). While inspired by Inquirer.js, `PyInquirer` was a different, less maintained project, and `InquirerPy` is another re-implementation. Ensure you are importing from `inquirer`.","wrong":"from PyInquirer import prompt","symbol":"Question Types","correct":"import inquirer\ninquirer.Text(...)\ninquirer.List(...)\ninquirer.Confirm(...)\ninquirer.Checkbox(...)\ninquirer.Editor(...)\ninquirer.Path(...)\ninquirer.Password(...)"}],"quickstart":{"code":"import inquirer\n\nquestions = [\n    inquirer.Text('name', message=\"What's your name?\"),\n    inquirer.List(\n        'size',\n        message=\"What size do you need?\",\n        choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],\n    ),\n    inquirer.Confirm('confirm', message=\"Proceed?\")\n]\n\nanswers = inquirer.prompt(questions)\nprint(f\"Hello, {answers['name']}! You selected {answers['size']} and confirmed: {answers['confirm']}\")","lang":"python","description":"This quickstart demonstrates how to create a list of different question types (Text, List, Confirm) and use `inquirer.prompt` to display them to the user, collecting the answers in a dictionary."},"warnings":[{"fix":"Upgrade Python to 3.9.2 or newer, or downgrade `inquirer` to 3.4.0 or earlier.","message":"Python 3.8 is no longer supported. Users on Python 3.8 will need to upgrade their Python version to 3.9.2 or higher, or stick to an older `inquirer` version (<=3.4.0).","severity":"breaking","affected_versions":">=3.4.1"},{"fix":"Review code using `inquirer.Path` and remove the `normalize_to_absolute_path` argument. Adjust path handling logic if absolute paths were previously relied upon through this argument.","message":"The `normalize_to_absolute_path` argument has been removed from the `inquirer.Path` question type.","severity":"breaking","affected_versions":">=3.3.0"},{"fix":"Ensure your validation lambda or function has the signature `def validate_func(answers, current):` even if `answers` is not used. Return `True` for success, or raise `inquirer.errors.ValidationError('', reason='Your custom message')` for a custom error.","message":"Validation functions for questions must accept two arguments: `(answers, current)`, where `answers` is a dictionary of previously collected responses and `current` is the input for the current question. Providing only one argument (e.g., `lambda current: ...`) will cause validation to always fail, as exceptions are caught and treated as validation errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your virtual environment is activated before running `pip install inquirer`. Verify that the Python interpreter being used is the one from the virtual environment.","message":"Users often encounter `ModuleNotFoundError` when installing `inquirer` in a virtual environment. This is typically due to the virtual environment not being correctly activated or `pip install` being run outside the activated environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use descriptive variable names for question IDs that do not conflict with Python's built-in keywords or types. For example, instead of `list = [...]`, use `my_list_of_questions = [...]`.","message":"Avoid using Python's built-in keywords or common types as variable names for your question IDs (e.g., `list`, `dict`). This can shadow the built-in type and lead to unexpected behavior or difficult-to-debug errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Report any Windows-specific issues encountered on the GitHub repository. Consider testing your CLI application on a UNIX-like environment if consistent behavior is critical across platforms.","message":"While Windows support has seen improvements (e.g., Unicode handling in v3.4.0), it is still considered experimental. Users may encounter platform-specific issues compared to UNIX-based systems.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'3.4.1':56 'activ':45 'aim':26 'answer':34 'applic':41 'ask':29 'base':20 'cli':40,57 'collect':11 'command':16 'command-lin':15 'common':13 'current':53 'hierarch':37 'inquir':2,3 'inquirer.js':24 'interact':14,58 'interfac':19,61 'librari':7,43 'line':17 'maintain':46 'manag':36 'pars':31 'popular':23 'prompt':38,59 'provid':9 'python':1,6 'question':30 'receiv':48 'regular':49 'simplifi':28 'updat':50 'user':18,60 'valid':33 'version':54","created_at":"2026-04-09T18:42:19.374209+00:00","updated_at":"2026-04-16T15:45:09.740337+00:00","problems":[{"fix":"Install the library using pip: `pip install inquirer`","cause":"The 'inquirer' library is not installed in the current Python environment or the Python interpreter being used does not have access to the installed library.","error":"ModuleNotFoundError: No module named 'inquirer'"},{"fix":"Ensure you are instantiating question objects from the `inquirer` module correctly. For example, to create a list question, use `inquirer.List(...)` after importing `inquirer`:\n```python\nimport inquirer\nquestions = [\n    inquirer.List('size',\n                   message='What size do you need?',\n                   choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],\n                  ),\n]\nanswers = inquirer.prompt(questions)\n```","cause":"This error typically occurs when trying to access a question type (like 'List', 'Checkbox', 'Text', etc.) directly as an attribute of the top-level 'inquirer' module, or if an older version of 'inquirer' is being used where these question types might have been structured differently. For version 3.4.1, question types are classes within the `inquirer` module and should be instantiated correctly.","error":"AttributeError: module 'inquirer' has no attribute 'List'"},{"fix":"In PyCharm, enable 'Emulate terminal in output console' in your Run/Debug Configuration. Alternatively, run your Python script directly from a system terminal (e.g., cmd, PowerShell, Bash) outside of the IDE.","cause":"Interactive command-line interfaces like Inquirer rely on terminal emulation features that are often not enabled by default in IDEs like PyCharm. The output console might not support the special terminal functionalities required for interactive prompts.","error":"Inquirer prompt not interactive / not working in PyCharm"},{"fix":"Ensure that the variable you are calling `.items()` on is indeed a dictionary. If `inquirer.prompt()` has returned its expected dictionary, you can iterate over it directly. If you have a list of dictionaries, iterate through the list first and then call `.items()` on each dictionary within the loop.\n```python\nimport inquirer\n\nquestions = [\n    inquirer.Text('name', message=\"What's your name\"),\n]\n\nanswers = inquirer.prompt(questions)\n\n# Correct usage: answers is a dictionary\nif answers:\n    for key, value in answers.items():\n        print(f\"{key}: {value}\")\n\n# Incorrect usage (would cause the error if 'my_list_var' was a list):\n# for key, value in my_list_var.items():\n#    print(f\"{key}: {value}\")\n```","cause":"This error occurs when attempting to call the `.items()` method on a Python list object. The `inquirer.prompt()` function returns a dictionary, but if the subsequent code incorrectly assumes a list (or tries to call `.items()` on a list that might be a value within the dictionary result), this error will be raised. The `.items()` method is exclusive to dictionary objects for iterating over key-value pairs.","error":"AttributeError: 'list' object has no attribute 'items'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.4.1","cli_name":"inquirer","cli_version":"sh: 1: inquirer: not found","type":"library","homepage":null,"github":"https://github.com/magmax/python-inquirer","docs":"https://python-inquirer.readthedocs.io","changelog":null,"pypi":"https://pypi.org/project/inquirer/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}