Interactive failed with an unexpected error
az feedbackauto-generates most of the information requested below, as of CLI version 2.0.70
Describe the bug
the following error occurs after entering az interactive.
The command failed with an unexpected error. Here is the traceback:
No module named 'prompt_toolkit.interface'
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 603, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 661, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 654, in _run_job
six.reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 631, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 305, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 485, in default_command_handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/interactive/custom.py", line 41, in start_shell
azext_interactive.start_shell(cmd, style=style)
File "/home/user1/.azure/cliextensions/interactive/azext_interactive/init.py", line 10, in start_shell
from .azclishell.app import AzInteractiveShell
File "/home/user1/.azure/cliextensions/interactive/azext_interactive/azclishell/app.py", line 27, in
To Reproduce
type az interactive .
Expected behavior Enter interactive mode.
Environment summary
Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)
az --version
azure-cli 2.0.70
command-modules-nspkg 2.0.3 core 2.0.70 nspkg 3.0.4 telemetry 1.0.3
Extensions: azure-devops 0.11.0 interactive 0.4.3 application-insights 0.1.1
Python location '/opt/az/bin/python3' Extensions directory '/home/user1/.azure/cliextensions'
Python (Linux) 3.6.5 (default, Jul 25 2019, 08:54:21) [GCC 7.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context Add any other context about the problem here.
I have the same problem
I had the same issue. In my case I'm in WSL v1 with an ubuntu 18.04
Taking a closer look, I noticed something:
~> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
~> python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from prompt_toolkit.interface import Application, CommandLineInterface
>>>
~> which az
/usr/bin/az
~> cat /usr/bin/az
#!/usr/bin/env bash
/opt/az/bin/python3 -Im azure.cli "$@"
So it looks like az is using a custom python installation, so we should probably install prompt_toolkit from within that installation.
fyi... @yugangw-msft posted a workaround in #10088.
dupe to #10088