Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run az extension add --name rdbms-connect #25869

Closed
nunomaia-diconium opened this issue Mar 17, 2023 · 14 comments
Closed

Unable to run az extension add --name rdbms-connect #25869

nunomaia-diconium opened this issue Mar 17, 2023 · 14 comments
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@nunomaia-diconium
Copy link

nunomaia-diconium commented Mar 17, 2023

I'm not able to add the rdbms-connect extension in a Ubuntu system.

Command Name
az extension add --name rdbms-connect

az version

{
  "azure-cli": "2.46.0",
  "azure-cli-core": "2.46.0",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "azure-devops": "0.26.0"
  }
}

Errors:

  changing mode of /tmp/pip-target-gv46rkve/bin/sqlformat to 755
  changing mode of /tmp/pip-target-gv46rkve/bin/pygmentize to 755

  DEPRECATION: psycopg2 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Created temporary directory: /tmp/pip-record-et86dbbz
  Running setup.py install for psycopg2: started
  Running command Running setup.py install for psycopg2
  /opt/az/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
    warnings.warn(msg, warning_class)
  running install
  /opt/az/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-310
  creating build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_ipaddress.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/errors.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/sql.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-cpython-310/psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-cpython-310
  creating build/temp.linux-x86_64-cpython-310/psycopg
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC "-DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140007 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/mnt/repo/python_env/include/python3.10 -I. -I/usr/include/postgresql -I/usr/include/postgresql/14/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-310/psycopg/adapter_asis.o -Wdeclaration-after-statement
  In file included from psycopg/adapter_asis.c:28:
  ./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
     35 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.

  It appears you are missing some prerequisite to build the package from source.

  You may install a binary package by installing 'psycopg2-binary' from PyPI.
  If you want to install psycopg2 from source, please install the packages
  required for the build and try again.

  For further information please check the 'doc/src/install.rst' file (also at
  <https://www.psycopg.org/docs/install.html>).

  error: command '/usr/bin/gcc' failed with exit code 1
  error: subprocess-exited-with-error
  
  × Running setup.py install for psycopg2 did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/../../opt/az/bin/python3 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-wsq6pv4h/psycopg2_e429fe0aa89a42829c005e297516245e/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /tmp/pip-record-et86dbbz/install-record.txt --single-version-externally-managed --home /tmp/pip-target-gv46rkve --compile --install-headers /tmp/pip-target-gv46rkve/include/python/psycopg2
  cwd: /tmp/pip-install-wsq6pv4h/psycopg2_e429fe0aa89a42829c005e297516245e/
  Running setup.py install for psycopg2: finished with status 'error'
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> psycopg2

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Exception information:
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/operations/install/legacy.py", line 97, in install
    runner(
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/utils/subprocess.py", line 252, in runner
    call_subprocess(
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/utils/subprocess.py", line 224, in call_subprocess
    raise error
pip._internal.exceptions.InstallationSubprocessError: Running setup.py install for psycopg2 exited with 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 507, in run
    installed = install_given_reqs(
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/req/__init__.py", line 73, in install_given_reqs
    requirement.install(
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 843, in install
    raise exc
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 825, in install
    success = install_legacy(
  File "/opt/az/lib/python3.10/site-packages/pip/_internal/operations/install/legacy.py", line 109, in install
    raise LegacyInstallFailure(package_details=req_name) from e
pip._internal.exceptions.LegacyInstallFailure: <LegacyInstallFailure: legacy-install-failure>
Removed build tracker: '/tmp/pip-build-tracker-sj4_xg_k'

DEBUG: cli.azure.cli.core.extension.operations: Command '['/usr/bin/../../opt/az/bin/python3', '-m', 'pip', 'install', '--target', '/opt/az/azcliextensions/rdbms-connect', '/tmp/tmpltas32s7/rdbms_connect-1.0.4-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1.
DEBUG: cli.azure.cli.core.extension.operations: Pip failed so deleting anything we might have installed at /opt/az/azcliextensions/rdbms-connect
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/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/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/extension/custom.py", line 16, in add_extension_cmd
    return add_extension(cli_ctx=cmd.cli_ctx, source=source, extension_name=extension_name, index_url=index_url,
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/extension/operations.py", line 344, in add_extension
    extension_name = _add_whl_ext(cli_ctx=cmd_cli_ctx, source=source, ext_sha256=ext_sha256,
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/extension/operations.py", line 173, in _add_whl_ext
    raise CLIError('An error occurred. Pip failed with status code {}. '
knack.util.CLIError: An error occurred. Pip failed with status code 1. Use --debug for more information.

ERROR: cli.azure.cli.core.azclierror: An error occurred. Pip failed with status code 1. Use --debug for more information.
ERROR: az_command_data_logger: An error occurred. Pip failed with status code 1. Use --debug for more information.
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fb16f5b6710>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.__main__: Command ran in 23.975 seconds (init: 0.274, invoke: 23.700)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3575 in cache
WARNING: telemetry.check: Negative: The /home/runner/.azure/telemetry.txt was modified at 2023-03-17 10:00:13.119087, which in less than 600.000000 s

Expected Behavior
Extension install without failures.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Installation labels Mar 17, 2023
@ghost ghost assigned jiasli Mar 17, 2023
@ghost ghost added this to the Backlog milestone Mar 17, 2023
@Andy65
Copy link

Andy65 commented Mar 17, 2023

We are also experiencing this issue with version 2.46.0, the previous version 2.45.0 was fine.

@nunomaia-diconium
Copy link
Author

We are also experiencing this issue with version 2.46.0, the previous version 2.45.0 was fine.

Exactly what I'm facing also.

@cvallesi-kainos
Copy link

Can confirm v2.45.0 is working properly

@challa456
Copy link

Even our pipeline is facing an issue with cli v2.45.0 to connect with acr

@yonzhan yonzhan added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 17, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 17, 2023

@bebound for awareness

@jonesty
Copy link

jonesty commented Mar 19, 2023

Exactly the same issue here. Our DevOps pipelines have been broken since release of CLI 2.46.0.

@bebound
Copy link
Contributor

bebound commented Mar 20, 2023

Workaround:
Update setuptools to latest version:
/opt/az/bin/python3 -Im pip install -U setuptools
Caused by setuptools bug pypa/setuptools#3589

Duplicate of Azure/azure-cli-extensions#6030

@jonesty
Copy link

jonesty commented Mar 20, 2023

Workaround: Update setuptools to latest version: /opt/az/bin/python3 -Im pip install -U setuptools Caused by setuptools bug pypa/setuptools#3589

Duplicate of Azure/azure-cli-extensions#6030

Worked for me. Thank you @bebound!

@yonzhan yonzhan closed this as completed Mar 20, 2023
@mallissr
Copy link

Hello Jonestly, how did you resolve this issue ? I am getting same error in windows powershell . Az cli version 2.48.1 , setuptools version setuptools-65.1.1

PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az extension add -n rdbms-connect
An error occurred. Pip failed with status code 2. Use --debug for more information.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>

@jonesty
Copy link

jonesty commented May 12, 2023

Hi @mallissr, I added the line /opt/az/bin/python3 -Im pip install -U setuptools to my script before installing the rdbms-connect extension. On my side this runs from an Azure DevOps release pipeline shell script.

@mallissr
Copy link

Thank you . I updated the setuptool still failing.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe -m pip install -U pip
Requirement already satisfied: pip in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (23.1.1)
Collecting pip
Downloading pip-23.1.2-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 18.8 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.1.1
Uninstalling pip-23.1.1:
Successfully uninstalled pip-23.1.1
WARNING: The scripts pip.exe, pip3.10.exe and pip3.exe are installed in 'C:\Program Files (x86)\Microsoft SDKs\Azure\C
LI2\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.1.2
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe -m pip install -U setuptools
Requirement already satisfied: setuptools in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (67.7.2)
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe -m pip install -U psycopg2
Collecting psycopg2
Downloading psycopg2-2.9.6-cp310-cp310-win32.whl (1.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 9.3 MB/s eta 0:00:00
Installing collected packages: psycopg2
Successfully installed psycopg2-2.9.6
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az extension add -n azure-devops
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az extension add -n rdbms-connect
An error occurred. Pip failed with status code 2. Use --debug for more information.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az version
{
"azure-cli": "2.48.1",
"azure-cli-core": "2.48.1",
"azure-cli-telemetry": "1.0.8",
"extensions": {
"azure-devops": "0.26.0"
}
}
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>

@jonesty
Copy link

jonesty commented May 12, 2023

@mallissr Have you tried running the command with the --debug flag to get more info?

@bebound
Copy link
Contributor

bebound commented May 12, 2023

@mallissr Please see #25067

@JonesKwameOsei
Copy link

Microsoft is the most stressful OS to use. Finding resolution to this Azure cli error is tiring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

10 participants