azure-cli: Az 2.48.1 ImportError: cannot import name 'Request' from partially initialized module 'requests.models'
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az servicebus namespace create
Errors:
The command failed with an unexpected error. Here is the traceback:
cannot import name 'Request' from partially initialized module 'requests.models' (most likely due to a circular import) (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\requests\models.pyc)
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 707, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 1156, in _is_poller
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 686, in poller_classes
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrestazure/__init__.py", line 28, in <module>
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrestazure/azure_configuration.py", line 34, in <module>
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/__init__.py", line 28, in <module>
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/configuration.py", line 37, in <module>
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\msrest/pipeline/__init__.py", line 52, in <module>
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\requests/__init__.py", line 135, in <module>
ImportError: cannot import name 'Request' from partially initialized module 'requests.models' (most likely due to a circular import) (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\requests\models.pyc)
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 servicebus namespace create --name ANY-VALID-NAME --sku Premium --resource-group MY-RG --location brazilsouth
Expected Behavior
Service successfully created. Just like with Az Cli 2.47.
Environment Summary
Windows-10-10.0.22621-SP0
Python 3.10.10
Installer: MSI
azure-cli 2.48.1
Extensions:
resource-graph 2.1.0
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
Additional Context
I found that by removing the location parameter the command works again.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 21 (6 by maintainers)
Commits related to this issue
- Workaround for az bug Can be removed once https://github.com/Azure/azure-cli/issues/26272#issuecomment-1534158361 is merged and release — committed to Particular/ServiceControl by andreasohlund a year ago
- workaround for https://github.com/Azure/azure-cli/issues/26272 — committed to helaili/github-oidc-auth-app by helaili a year ago
- Bypass command index https://github.com/Azure/azure-cli/issues/26272#issuecomment-1534158361 — committed to Particular/ServiceControl by mikeminutillo a year ago
- Bypass command index https://github.com/Azure/azure-cli/issues/26272#issuecomment-1534158361 — committed to Particular/ServiceControl by mikeminutillo a year ago
- Workaround AZ CLI issue https://github.com/Azure/azure-cli/issues/26272#issuecomment-1534158361 — committed to Particular/NServiceBus.AzureFunctions.InProcess.ServiceBus by mauroservienti a year ago
- Workaround AZ CLI issue https://github.com/Azure/azure-cli/issues/26272#issuecomment-1534158361 — committed to Particular/NServiceBus.AzureFunctions.Worker.ServiceBus by mauroservienti a year ago
that is a very long time to get a fix. considering many if not all commands are broken by this, can you at least remove the broken release?
Sorry for the trouble. The fix will be included in the May 23th release. There is another workaround, which is to disable the command index using the “AZURE_CORE_USE_COMMAND_INDEX=False” environment variable. It can import
requests
module in main thread but it will slow down command loading time.I’m having the same issue with an analytics workspace
az monitor log-analytics workspace create --resource-group $ResourceGroup --workspace-name $WorkspaceName --ingestion-access 'Enabled' --location $Location --query-access 'Enabled' --quota '-1' --retention-time $WorkspaceRetention --sku $WorkspaceSku --tags ${BaseTags} -o $OutputFormat
It will be May 23
It is solved for me as well! We use the Azure CLI for a lot of our pipelines, it is crazy to think that this can be broken in the hosted agent for weeks, this has been broken for over a month. There has to be better unit test and system tests to prevent this from happening.
Are you using a hosted agent? I still see 20230507.1 as the image version.
Same for me. When is this going to be fixed? It’s breaking our release pipeline. When will the fix be available on Azure DevOps hosted agents?
@fvalencia12 this other workaround worked for me
Great… broken deployments. Service Bus is being moved to the top of my “move away from this technology” list! Any news on a fix?
The current workaround is adding
--no-wait
which will bypass the polling functions. And callxxxx wait
commandWe will update the packaged python version in the next release.