Azure CLI ERROR when add extensions: An error occurred. Pip failed with status code 1

Carlos Ochoa Medrano 40 Reputation points
2023-12-01T05:55:00.18+00:00

Hi everyone

I'm trying to add extensions in Azure CLI with the command: az extension add --name subscription
however I get the following message:

An error occurred. Pip failed with status code 1. Use --debug for more information.

User's image

Here the debug lines :

C:\Users\USERNAME>az extension add --name subscription --debug
cli.azure.cli.core.extension._resolve: Candidates ['subscription-0.1.3-py2.py3-none-any.whl', 'subscription-0.1.4-py2.py3-none-any.whl', 'subscription-0.1.5-py2.py3-none-any.whl']
cli.azure.cli.core.extension._resolve: Candidates ['subscription-0.1.3-py2.py3-none-any.whl', 'subscription-0.1.4-py2.py3-none-any.whl', 'subscription-0.1.5-py2.py3-none-any.whl']
cli.azure.cli.core.extension._resolve: Chosen {'downloadUrl': 'https://azcliprod.blob.core.windows.net/cli-extensions/subscription-0.1.5-py2.py3-none-any.whl', 'filename': 'subscription-0.1.5-py2.py3-none-any.whl', 'metadata': {'azext.isPreview': True, 'azext.minCliCoreVersion': '2.0.30', 'classifiers': ['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License'], 'extensions': {'python.details': {'contacts': [{'email': 'wilcob@microsoft.com', 'name': 'Wilco Bauwer', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': 'https://github.com/Azure/azure-cli-extensions/tree/main/src/subscription'}}}, 'generator': 'bdist_wheel (0.30.0)', 'license': 'MIT', 'metadata_version': '2.0', 'name': 'subscription', 'summary': 'Support for subscription management preview.', 'version': '0.1.5'}, 'sha256Digest': 'ff7896aebc46862a6d30ac5f4cf64bdd40cb50e5437cea299590896d75f1013e'}
cli.azure.cli.core.extension.operations: Extension source is url? True
cli.azure.cli.core.extension.operations: Downloading https://azcliprod.blob.core.windows.net/cli-extensions/subscription-0.1.5-py2.py3-none-any.whl to C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl
urllib3.connectionpool: Starting new HTTPS connection (1): azcliprod.blob.core.windows.net:443
urllib3.connectionpool: https://azcliprod.blob.core.windows.net:443 "GET /cli-extensions/subscription-0.1.5-py2.py3-none-any.whl HTTP/1.1" 200 45407
cli.azure.cli.core.extension.operations: Downloaded to C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl
cli.azure.cli.core.extension.operations: Validating the extension C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl
cli.azure.cli.core.extension.operations: Checksum of C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl is OK
cli.azure.cli.core.extension.operations: Validation successful on C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl
cli.azure.cli.core.extension.operations: Executing pip with args: ['install', '--target', 'C:\\Users\\USERNAME\\.azure\\cliextensions\\subscription', 'C:\\Users\\USERNAME~1\\AppData\\Local\\Temp\\tmpqcky07e7\\subscription-0.1.5-py2.py3-none-any.whl']
cli.azure.cli.core.extension.operations: Running: ['C:\\Program Files\\Microsoft SDKs\\Azure\\CLI2\\python.exe', '-m', 'pip', 'install', '--target', 'C:\\Users\\USERNAME\\.azure\\cliextensions\\subscription', 'C:\\Users\\USERNAME~1\\AppData\\Local\\Temp\\tmpqcky07e7\\subscription-0.1.5-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']
cli.azure.cli.core.extension.operations: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\__main__.py", line 22, in <module>
    from pip._internal.cli.main import main as _main
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\build_env.py", line 19, in <module>
    from pip._internal.cli.spinners import open_spinner
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\cli\spinners.py", line 9, in <module>    from pip._internal.utils.logging import get_indentation
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\utils\logging.py", line 29, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\utils\misc.py", line 44, in <module>
    from pip._internal.locations import get_major_minor_version
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\locations\__init__.py", line 14, in <module>
    from . import _sysconfig
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\locations\_sysconfig.py", line 11, in <module>
    from .base import change_root, get_major_minor_version, is_osx_framework
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\locations\base.py", line 9, in <module>
    from pip._internal.utils import appdirs
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\utils\appdirs.py", line 13, in <module>
    from pip._vendor import platformdirs as _appdirs
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 46, in <module>
    PlatformDirs = _set_platform_dir_class()  #: Currently active platform
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_vendor\platformdirs\__init__.py", line 26, in _set_platform_dir_class
    from pip._vendor.platformdirs.windows import Windows as Result
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_vendor\platformdirs\windows.py", line 4, in <module>
    import ctypes
  File "ctypes\__init__.py", line 8, in <module>
ImportError: DLL load failed while importing _ctypes: No se puede encontrar el módulo especificado.

And my CLI version:

C:\Users\USERNAME>az --version 
azure-cli                         2.54.0
  
core                              2.54.0 
telemetry                          1.1.0  

Dependencies: 
msal                            1.24.0b2 
azure-mgmt-resource             23.1.0b2  

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' 
Extensions directory 'C:\Users\USERNAME\.azure\cliextensions'  

Python (Windows) 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,723 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
328 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,323 questions
{count} votes

Accepted answer
  1. navba-MSFT 20,635 Reputation points Microsoft Employee
    2023-12-04T04:16:55.4766667+00:00

    @Carlos Ochoa Medrano I'm glad to see you were able to resolve your issue. Thanks for posting your solution so that others experiencing the same thing can easily reference this. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
    .
    Issue:
    While running the AzCLi command az extension add --name subscriptionYou are encountering the following message:

    An error occurred. Pip failed with status code 1. Use --debug for more information.

    Resolution:
    You uninstalled Anaconda Navigator and that resolved the issue.

    4 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful