question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`az interactive` fails to start: ModuleNotFoundError: No module named 'prompt_toolkit.interface'

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az interactive

Errors:

The command failed with an unexpected error. Here is the traceback:
No module named 'prompt_toolkit.interface'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/homebrew/Cellar/azure-cli/2.41.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/interactive/custom.py", line 41, in start_shell
    azext_interactive.start_shell(cmd, style=style)
  File "/Users/davide.agnello/.azure/cliextensions/interactive/azext_interactive/__init__.py", line 10, in start_shell
    from .azclishell.app import AzInteractiveShell
  File "/Users/davide.agnello/.azure/cliextensions/interactive/azext_interactive/azclishell/app.py", line 33, in <module>
    from prompt_toolkit.interface import Application, CommandLineInterface
ModuleNotFoundError: No module named 'prompt_toolkit.interface'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az interactive

Expected Behavior

Environment Summary

macOS-12.5.1-arm64-arm-64bit, Darwin 21.6.0
Python 3.10.8
Installer: HOMEBREW

azure-cli 2.41.0

Extensions:
interactive 0.4.5

Dependencies:
msal 1.20.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
beboundcommented, Oct 17, 2022

In https://github.com/Azure/azure-cli/pull/22459, mycli is added in dependency, which requires prompt-toolkit. azure-cli installs 3.0.31 and interactive wants 1.0.18, so the conflict occurs.

1reaction
dagnellocommented, Oct 17, 2022

@jiasli

prompt_toolkit module is installed under /usr/lib64/az/lib/python3.9/site-packages/ by azure-cli 2.41.0 package.

$ PYTHONPAPYTHONPATH=/usr/lib64/az/lib/python3.9/site-packages/ /usr/bin/python3.9 \
-c "import sys; sys.path; import prompt_toolkit; import prompt_toolkit.interface"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'prompt_toolkit.interface'

Remove it will fix the issue.

$ sudo rm -rf /usr/lib64/az/lib/python3.9/site-packages/prompt_toolkit

$ az interactive
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

az>>

@taoyama your suggestion worked, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

az interactive fails: No module named 'prompt_toolkit.interface'
Describe the bug. Command Name az interactive. Errors: No module named 'prompt_toolkit.interface' Traceback (most recent call last): ...
Read more >
[Fixed] ModuleNotFoundError: No module named 'prompt-toolkit'
The most frequent source of this error is that you haven't installed prompt-toolkit explicitly with pip install prompt-toolkit . Alternatively, you may have ......
Read more >
Can't start Azure Interactive mode - Stack Overflow
When I run the command az interactive either in Local Windows PowerShell or Azure CLI Command Prompt, I'm getting the same error because...
Read more >
"az interactive" command does not work in Microsoft Learn ...
The command failed with an unexpected error. Here is the traceback: No module named 'prompt_toolkit.interface'; Traceback (most recent call ...
Read more >
No module named 'prompt toolkit enums' - YouTube
Getting error can be frustrating specially if you are working on some idea. Recently I started to get error in my jupyter notebook...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found