Skip to content

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

@nunomaia-diconium

Description

@nunomaia-diconium

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.

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamInstallationcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions