Closed NicoSchwaller closed 4 years ago
Thanks for reaching out. This probably has something to do with upgrading boto3 to have the braket client. Please run
pip install boto3 --upgrade
To troubleshoot further, please make sure that you can call get_device in boto3: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/braket.html#Braket.Client.get_device
Let us know if this has solved your problem.
Thank you for the answer. I upgraded boto3 and this did not solve the problem, I have the same error when I call the get_device() method. My version of boto3 is 1.14.46.
virtualenv braket
cd braket
source bin/activate
git clone https://github.com/aws/amazon-braket-sdk-python.git
pip install -e amazon-braket-sdk-python
python amazon-braket-sdk-python/examples/bell.py
Traceback (most recent call last):
File "amazon-braket-sdk-python/examples/bell.py", line 21, in <module>
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
File "/Users/$(whoami)/git/braket/amazon-braket-sdk-python/src/braket/aws/aws_device.py", line 76, in __init__
self.refresh_metadata()
File "/Users/$(whoami)/git/braket/amazon-braket-sdk-python/src/braket/aws/aws_device.py", line 155, in refresh_metadata
metadata = self._aws_session.get_device(self._arn)
File "/Users/$(whoami)/git/braket/amazon-braket-sdk-python/src/braket/aws/aws_session.py", line 118, in get_device
return self.braket_client.get_device(deviceArn=arn)
File "/Users/$(whoami)/git/braket/lib/python3.7/site-packages/botocore/client.py", line 575, in __getattr__
self.__class__.__name__, item)
AttributeError: 'Braket' object has no attribute 'get_device'
pip freeze | grep boto3
boto3==1.14.46
Thanks @jmp-aws, I'm still unable to reproduce the error. I think it's due to the AWS CLI not being up to date, because the get_device API isn't able to be called.
Another option is to uninstall and re-install boto3.
Or, to start from a new virtualenv and run:
pip install amazon-braket-sdk
python3 -m venv braket
cd braket
source bin/activate
pip install amazon-braket-sdk
# created bell.py file from copying and pasting from the repo
python bell.py
Traceback (most recent call last):
File "bell.py", line 8, in <module>
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
File "/Users/$(whoami)/git/braket/lib/python3.8/site-packages/braket/aws/aws_device.py", line 76, in __init__
self.refresh_metadata()
File "/Users/$(whoami)/git/braket/lib/python3.8/site-packages/braket/aws/aws_device.py", line 155, in refresh_metadata
metadata = self._aws_session.get_device(self._arn)
File "/Users/$(whoami)/git/braket/lib/python3.8/site-packages/braket/aws/aws_session.py", line 118, in get_device
return self.braket_client.get_device(deviceArn=arn)
File "/Users/$(whoami)/git/braket/lib/python3.8/site-packages/botocore/client.py", line 573, in __getattr__
raise AttributeError(
AttributeError: 'Braket' object has no attribute 'get_device'
amazon-braket-default-simulator==1.0.0.post1
amazon-braket-schemas==1.0.0.post1
amazon-braket-sdk==1.0.0.post1
backoff==1.10.0
boltons==20.2.1
boto3==1.14.46
botocore==1.17.46
decorator==4.4.2
docutils==0.15.2
jmespath==0.10.0
nest-asyncio==1.4.0
networkx==2.4
numpy==1.19.1
opt-einsum==3.3.0
pydantic==1.6.1
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.15.0
urllib3==1.25.10
Still unable to reproduce the error.
Have you tried running:
aws braket help
in the command line and seeing if get-device appears in the list of available commands?
If not, the version of the AWS CLI you have needs to be updated.
aws braket help
AVAILABLE COMMANDS
o cancel-quantum-task
o create-quantum-job
o create-quantum-task
o describe-qpus
o describe-quantum-simulators
o get-quantum-job
o get-quantum-task
o help
o list-quantum-jobs
o list-quantum-tasks
o stop-quantum-job
working on trying to remove braket definition of aws cli installation
brew uninstall awscli
rm -rf ~/.aws/models/aqx
rm -rf ~/.aws/models/braket
brew install awscli
aws braket help
AVAILABLE COMMANDS
o cancel-quantum-task
o create-quantum-task
o get-device
o get-quantum-task
o help
o search-devices
o search-quantum-tasks
python bell.py
Counter({'11': 56, '00': 44})
@NicoSchwaller does removal of any aws cli models, uninstallation, and re-installation help resolve the issue? These are the commands that solved the issue for myself
brew uninstall awscli
rm -rf ~/.aws/models/aqx
rm -rf ~/.aws/models/braket
brew install awscli
aws braket help
@NicoSchwaller does removal of any aws cli models, uninstallation, and re-installation help resolve the issue? These are the commands that solved the issue for myself
brew uninstall awscli rm -rf ~/.aws/models/aqx rm -rf ~/.aws/models/braket brew install awscli aws braket help
Yes, this did solve the problem, thanks a lot!
Describe the bug When executing the example bell.py, the following error appears:
AttributeError Traceback (most recent call last)