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

Carlos Ochoa Medrano 40 Reputation points

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 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'] 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'] Chosen {'downloadUrl': '', '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': '', 'name': 'Wilco Bauwer', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': ''}}}, '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'} Extension source is url? True Downloading 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):
urllib3.connectionpool: "GET /cli-extensions/subscription-0.1.5-py2.py3-none-any.whl HTTP/1.1" 200 45407 Downloaded to C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl Validating the extension C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl Checksum of C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl is OK Validation successful on C:\Users\USERNAME~1\AppData\Local\Temp\tmpqcky07e7\subscription-0.1.5-py2.py3-none-any.whl 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'] 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'] 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\", 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\", 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\", 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\", 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\", 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\", 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\", 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\", 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\", line 14, in <module>
    from . import _sysconfig
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\locations\", 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\", line 9, in <module>
    from pip._internal.utils import appdirs
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_internal\utils\", 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\", 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\", line 26, in _set_platform_dir_class
    from import Windows as Result
  File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip\_vendor\platformdirs\", line 4, in <module>
    import ctypes
  File "ctypes\", 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  

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
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
328 questions
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

    @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.
    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.

    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