Skip to content

[commands] aether:install always reports amazon-braket-sdk as NOT INSTALLED because braket has no __version__ #71

Description

@corgab

Summary

AetherInstallCommand::checkDependencies() probes the SDK with python -c 'import braket; print(braket.__version__)'. braket is a namespace package shared by several Amazon packages and exposes no __version__; the SDK version lives in braket._sdk.__version__ (or importlib.metadata.version("amazon-braket-sdk")). The probe therefore exits 1 on every machine, including ones with a working SDK.

Verified with amazon-braket-sdk 1.127.0:

$ python -c 'import braket; print(braket.__version__)'
AttributeError: module 'braket' has no attribute '__version__'
$ python -c 'import braket._sdk; print(braket._sdk.__version__)'
1.127.0

Where

  • src/Commands/AetherInstallCommand.php:110-112 (the probe command)
  • src/Commands/AetherInstallCommand.php:122-124 (the NOT INSTALLED branch that always wins)
  • tests/Feature/Commands/AetherInstallCommandTest.php (no coverage of the dependency check: the whole command runs against Quantum::fake())

Why it is a problem

Every php artisan aether:install tells the user Braket is missing, then either prompts to create a venv or prints manual install instructions, even when the environment is already correct. A user who follows the prompt ends up with a second, redundant virtualenv. The success path of the command is unreachable in practice.

Suggested fix

Probe with importlib.metadata.version("amazon-braket-sdk"), which works regardless of the package layout and returns the distribution version. While there, compare the detected version against the floor declared in bin/python/requirements.txt (see #29) and print a warning when it is too old, so the command enforces the requirement instead of only displaying a number. Cover both branches in AetherInstallCommandTest with a fake interpreter script, the same technique tests/Unit/Bridge/PythonBridgeTest.php already uses.

Severity: medium

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions