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.

ImportError: cannot import name 'BatchManagementClient' from 'azure.mgmt.batch'

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az network traffic-manager profile check-dns

Errors:

cannot import name 'BatchManagementClient' from 'azure.mgmt.batch' (/usr/lib/python3/dist-packages/azure/mgmt/batch/__init__.py)
Traceback (most recent call last):
python3/dist-packages/knack/cli.py, ln 231, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 558, in execute
    self.commands_loader.load_arguments(command)
...
network/private_link_resource_and_endpoint_connections/resource_providers/batch_provider.py, ln 6, in <module>
    from azure.mgmt.batch import BatchManagementClient
ImportError: cannot import name 'BatchManagementClient' from 'azure.mgmt.batch' (/usr/lib/python3/dist-packages/azure/mgmt/batch/__init__.py)

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 network traffic-manager profile check-dns {}

Expected Behavior

Environment Summary

Linux-5.10.0-kali9-amd64-x86_64-with-glibc2.31
Python 3.9.2
Installer: DEB

azure-cli 2.18.0 *

Extensions:
azure-devops 0.19.0

Additional Context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jiaslicommented, Aug 25, 2021

I noticed a weird thing. The official Azure CLI DEB installer has its bundled Python 3.6.10.

$ az -v
azure-cli                         2.27.2

core                              2.27.2
...

Python location '/opt/az/bin/python3'
Extensions directory '/home/user1/.azure/cliextensions'

Python (Linux) 3.6.10 (default, Aug 23 2021, 03:36:00)
[GCC 9.3.0]

But in all linked issues, Python is 3.9.* and Azure CLI is 2.18.0:

Linux-5.10.0-kali9-amd64-x86_64-with-glibc2.31
Python 3.9.2
Installer: DEB

azure-cli 2.18.0 *

Could you let me know the distribution of Linux you are using by running

cat /etc/os-release

Where did you install this Linux? From official installation source? From docker?

Before installing the official Azure CLI, please remove the pre-installed Azure CLI, which is not maintained by Microsoft:

sudo apt remove azure-cli -y && sudo apt autoremove -y
0reactions
jiaslicommented, Aug 27, 2021

@Phoenix1112, please notice installing on Kali Linux with apt is currently not supported (#19369). Please use pip to install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'BatchManagementClient' from 'azure ...
Describe the bug. When running the command below, I previously would get a list of IP addresses. Now I get the error attached....
Read more >
#989670 - azure-cli: az network commands throw ImportError
... The command failed with an unexpected error. Here is the traceback: cannot import name 'BatchManagementClient' from 'azure.mgmt.batch' ...
Read more >
azure-mgmt-batch 17.0.0 - PyPI
This is the Microsoft Azure Batch Management Client Library. This package has been tested with Python 3.7+. For a more complete view of...
Read more >
Bug#989670: azure-cli: az network commands throw ImportError
CLIInternalError: The command failed with an unexpected error. Here is the traceback: cannot import name 'BatchManagementClient' from 'azure.
Read more >
Get Keys - REST API (Azure Batch Management)
An error response from the Batch service. BatchAccountKeys. A set of Azure Batch account keys. Name, Type, Description. accountName.
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