Does python "inquirer" module not work with Jupyter Notebook?

Viewed 865

I am trying to prompt the user for selecting an option from a finite list of options. I tried using inquirer.List(). The inquirer module seems to work fine on my windows shell but it does not work with Jupyter Notebook. On running the cell with

questions = [inquirer.List('regression_model', message = 'Select the best Regression Model as per Model Perfomance',
                          choices = ['Multiple Linear Regression', 'Polynomial Regression', 'Ridge Regression'])]

answers = inquirer.prompt(questions)

the Kernel keeps busy and it does not prompt for the options. I thought there was some trouble with importing inquirer so I did !pip install inquirer in the Jupyter Notebook too and it said that the requirement was already satisified so it doesn't seems to be an importing problem.

Does inquirer not work with Jupyter Notebook? If not, what alternatives can I use for prompting an option from a finite list of options?

1 Answers

Inquirer may conflict with Jupyter notebook since is a command line based tool. Instead, you can actually use the ipywidgets module. Ipywidgets is a python module that you can import to jupyter notebook that offers a direct implementation of multiple widgets, such as dropdowns, slidebars, etc. You can find more information regarding its usage by checking the following link. Furthermore, you could probably use the DropDown widget or a dynamic layout for this purpose.

Related