azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

rdbms-connect 1.0.3 seems to be broken

Open edeandrea opened this issue 3 years ago • 9 comments

  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

Related command

az postgres flexible-server execute -h

Extension name (the extension in question)

rdbms-connect

Description of issue (in as much detail as possible)

When I try to run az postgres flexible-server execute -h with version 1.0.3 of the rdbms-connect extension I get this:

The command failed with an unexpected error. Here is the traceback:
dlopen(/Users/edeandre/.azure/cliextensions/rdbms-connect/psycopg2/_psycopg.cpython-310-darwin.so, 0x0002): Library not loaded: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib'
  Referenced from: '/Users/edeandre/.azure/cliextensions/rdbms-connect/psycopg2/_psycopg.cpython-310-darwin.so'
  Reason: tried: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no such file)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 561, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/__init__.py", line 507, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 318, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
  File "/opt/homebrew/Cellar/azure-cli/2.40.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/opt/homebrew/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/edeandre/.azure/cliextensions/rdbms-connect/azext_rdbms_connect/custom.py", line 10, in <module>
    import psycopg2
  File "/Users/edeandre/.azure/cliextensions/rdbms-connect/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: dlopen(/Users/edeandre/.azure/cliextensions/rdbms-connect/psycopg2/_psycopg.cpython-310-darwin.so, 0x0002): Library not loaded: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib'
  Referenced from: '/Users/edeandre/.azure/cliextensions/rdbms-connect/psycopg2/_psycopg.cpython-310-darwin.so'
  Reason: tried: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no such file)

When I downgrade the extension to 1.0.2 it works fine.

edeandrea avatar Sep 12 '22 14:09 edeandrea

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Sep 12 '22 14:09 ghost

route to CXP team

yonzhan avatar Sep 12 '22 14:09 yonzhan

@edeandrea I am not able to reproduce this and az postgres works fine with the rdbms-connect - 1.0.3 version. Can you please try upgrading your Az CLI version.

SaurabhSharma-MSFT avatar Oct 03 '22 23:10 SaurabhSharma-MSFT

I already have the latest version of the az cli

╰─ az version                                                                              
{
  "azure-cli": "2.40.0",
  "azure-cli-core": "2.40.0",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "containerapp": "0.3.10",
    "log-analytics": "0.2.2",
    "rdbms-connect": "1.0.2"
  }
}

Not sure if it matters but I'm running a Mac M1. macos 12.6

edeandrea avatar Oct 04 '22 00:10 edeandrea

@edeandrea ok. got it. It looks like issue with the initial dependencies not available on macOS machine which normally gets installed during the installation of rdms-connect version. Can you please try upgrading rdbms-connect version to 1.0.3. I am also checking internally in the meantime if there are any known issues.

SaurabhSharma-MSFT avatar Oct 07 '22 18:10 SaurabhSharma-MSFT

The issue is when I upgrade to 1.0.3 it no longer works. It works fine on 1.0.2.

edeandrea avatar Oct 07 '22 18:10 edeandrea

@edeandrea Thanks for the updates. I am checking internally on this and get back to you at the earliest. Thanks

SaurabhSharma-MSFT avatar Oct 07 '22 18:10 SaurabhSharma-MSFT

Thank you.

@agoncal have you run into this?

edeandrea avatar Oct 07 '22 18:10 edeandrea

I am also experiencing this bug when I install version 1.0.2 or 1.0.3. It keeps attempting to install 'clang' and failing.

Also on Mac M1. macos 12.6

chaskett avatar Oct 11 '22 10:10 chaskett

@edeandrea Product team has released a new version of rdbms-connect (1.0.4) that could possibly solve this issue for macOS. Can we please check and confirm back if it works for with version 1.0.4?

SaurabhSharma-MSFT avatar Oct 25 '22 23:10 SaurabhSharma-MSFT

Hi @SaurabhSharma-MSFT 1.0.4 seems to work fine for me! Thanks for following up!

edeandrea avatar Oct 26 '22 13:10 edeandrea

@edeandrea Great to hear. We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

SaurabhSharma-MSFT avatar Oct 26 '22 17:10 SaurabhSharma-MSFT