question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QPU_REGIONS does not have a key for Rigetti Aspen-9

See original GitHub issue

Describe the bug

In [1]: import braket.aws                                       

In [2]: ionq_arn, rigetti_arn = "arn:aws:braket:::device/qpu/ionq/ionQdevice", "arn:aws:braket:::device/qpu/rigetti/Aspen-9"                                                                                                                                      
                                                                
In [3]: braket.aws.aws_device.AwsDevice(ionq_arn)  # no problems                                                                 
Out[3]: Device('name': IonQ Device, 'arn': arn:aws:braket:::device/qpu/ionq/ionQdevice)
                                                                
In [4]: braket.aws.aws_device.AwsDevice(rigetti_arn)  # problems!                                                                
---------------------------------------------------------------------------
NoRegionError                             Traceback (most recent call last)                                                                                                                                                                                       
<ipython-input-4-330bf07a097a> in <module>
----> 1 braket.aws.aws_device.AwsDevice(rigetti_arn)  # problems!

Additional context QPU_REGIONS does not have an entry for the new Aspen-9 device (active while Aspen-8 in maintenance). (Eventually, it would be preferable to not hardcode the regions of course)

I’m currently fixing it by re-initializing the QPU_REGIONS of the AwsDevice class and including the missing arn. I imagine there is also a way to instead configure the region via an AwsSession but I got stuck trying to do that (please let me know if there is a nice way to do it).

Screenshots or logs Full stacktrace:

In [4]: braket.aws.aws_device.AwsDevice(rigetti_arn)  # problems!                                                                
---------------------------------------------------------------------------
NoRegionError                             Traceback (most recent call last)
<ipython-input-4-330bf07a097a> in <module>
----> 1 braket.aws.aws_device.AwsDevice(rigetti_arn)  # problems!

~/miniconda3/lib/python3.7/site-packages/braket/aws/aws_device.py in __init__(self, arn, aws_session)
     86         super().__init__(name=None, status=None)
     87         self._arn = arn
---> 88         self._aws_session = AwsDevice._aws_session_for_device(arn, aws_session)
     89         self._properties = None
     90         self._provider_name = None

~/miniconda3/lib/python3.7/site-packages/braket/aws/aws_device.py in _aws_session_for_device(device_arn, aws_session)
    315         """AwsSession: Returns an AwsSession for the device ARN."""
    316         if "qpu" in device_arn:
--> 317             return AwsDevice._aws_session_for_qpu(device_arn, aws_session)
    318         else:
    319             return aws_session or AwsSession()

~/miniconda3/lib/python3.7/site-packages/braket/aws/aws_device.py in _aws_session_for_qpu(device_arn, aws_session)
    328         AWS Regions the devices are located in.
    329         """
--> 330         return AwsDevice._copy_aws_session(aws_session, AwsDevice.QPU_REGIONS.get(device_arn), None)
    331 
    332     @staticmethod

~/miniconda3/lib/python3.7/site-packages/braket/aws/aws_device.py in _copy_aws_session(aws_session, region, max_connections)
    353         else:
    354             boto_session = boto3.Session(region_name=region) if region else None
--> 355             return AwsSession(boto_session=boto_session, config=config)
    356 
    357     def __repr__(self):

~/miniconda3/lib/python3.7/site-packages/braket/aws/aws_session.py in __init__(self, boto_session, braket_client, config)
     38             self.braket_client = braket_client
     39         else:
---> 40             self.braket_client = self.boto_session.client("braket", config=self._config)
     41 
     42     #

~/miniconda3/lib/python3.7/site-packages/boto3/session.py in client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    261             aws_access_key_id=aws_access_key_id,
    262             aws_secret_access_key=aws_secret_access_key,
--> 263             aws_session_token=aws_session_token, config=config)
    264 
    265     def resource(self, service_name, region_name=None, api_version=None,

~/miniconda3/lib/python3.7/site-packages/botocore/session.py in create_client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    836             is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify,
    837             credentials=credentials, scoped_config=self.get_scoped_config(),
--> 838             client_config=config, api_version=api_version)
    839         monitor = self._get_internal_component('monitor')
    840         if monitor is not None:

~/miniconda3/lib/python3.7/site-packages/botocore/client.py in create_client(self, service_name, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, api_version, client_config)
     85         client_args = self._get_client_args(
     86             service_model, region_name, is_secure, endpoint_url,
---> 87             verify, credentials, scoped_config, client_config, endpoint_bridge)
     88         service_client = cls(**client_args)
     89         self._register_retries(service_client)

~/miniconda3/lib/python3.7/site-packages/botocore/client.py in _get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge)
    326         return args_creator.get_client_args(
    327             service_model, region_name, is_secure, endpoint_url,
--> 328             verify, credentials, scoped_config, client_config, endpoint_bridge)
    329 
    330     def _create_methods(self, service_model):

~/miniconda3/lib/python3.7/site-packages/botocore/args.py in get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge)
     71         final_args = self.compute_client_args(
     72             service_model, client_config, endpoint_bridge, region_name,
---> 73             endpoint_url, is_secure, scoped_config)
     74 
     75         service_name = final_args['service_name']

~/miniconda3/lib/python3.7/site-packages/botocore/args.py in compute_client_args(self, service_model, client_config, endpoint_bridge, region_name, endpoint_url, is_secure, scoped_config)
    152             is_secure=is_secure,
    153             endpoint_bridge=endpoint_bridge,
--> 154             s3_config=s3_config,
    155         )
    156         # Create a new client config to be passed to the client based

~/miniconda3/lib/python3.7/site-packages/botocore/args.py in _compute_endpoint_config(self, service_name, region_name, endpoint_url, is_secure, endpoint_bridge, s3_config)
    218         if service_name == 'sts':
    219             return self._compute_sts_endpoint_config(**resolve_endpoint_kwargs)
--> 220         return self._resolve_endpoint(**resolve_endpoint_kwargs)
    221 
    222     def _compute_s3_endpoint_config(self, s3_config,

~/miniconda3/lib/python3.7/site-packages/botocore/args.py in _resolve_endpoint(self, service_name, region_name, endpoint_url, is_secure, endpoint_bridge)
    301                           endpoint_url, is_secure, endpoint_bridge):
    302         return endpoint_bridge.resolve(
--> 303             service_name, region_name, endpoint_url, is_secure)
    304 
    305     def _compute_socket_options(self, scoped_config):

~/miniconda3/lib/python3.7/site-packages/botocore/client.py in resolve(self, service_name, region_name, endpoint_url, is_secure)
    400         region_name = self._check_default_region(service_name, region_name)
    401         resolved = self.endpoint_resolver.construct_endpoint(
--> 402             service_name, region_name)
    403 
    404         # If we can't resolve the region, we'll attempt to get a global

~/miniconda3/lib/python3.7/site-packages/botocore/regions.py in construct_endpoint(self, service_name, region_name, partition_name)
    132         for partition in self._endpoint_data['partitions']:
    133             result = self._endpoint_for_partition(
--> 134                 partition, service_name, region_name)
    135             if result:
    136                 return result

~/miniconda3/lib/python3.7/site-packages/botocore/regions.py in _endpoint_for_partition(self, partition, service_name, region_name, force_partition)
    146                 region_name = service_data['partitionEndpoint']
    147             else:
--> 148                 raise NoRegionError()
    149         # Attempt to resolve the exact region for this partition.
    150         if region_name in service_data['endpoints']:

NoRegionError: You must specify a region.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
singular-valuecommented, Mar 2, 2021

Okay cool so actually things now work when I have a region in ~/.aws/credentials !

Feel free to close.

0reactions
singular-valuecommented, Mar 2, 2021

Hmmm strange, braket._sdk.version is indeed ‘1.5.9.post0’ but let me do some investigating and get back to you

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building scalable, innovative quantum systems
Rigetti systems are powered by superconducting qubit-based quantum processors. As a lithographically defined chip-based technology, superconducting qubits are ...
Read more >
Rigetti Computing: Quantum Computing
Practical quantum computing. Delivered over the cloud.
Read more >
Rigetti Announces New Partnerships, Provides Business ...
“We are making strategic investments in quantum hardware, software, and partnerships that we believe will enable us to progress toward Quantum ...
Read more >
Rigetti Computing Announces Commercial Availability of 80 ...
Rigetti Computing Announces Commercial Availability of 80-Qubit Aspen-M System and Results of CLOPS Speed Tests · Aspen-M System Availability.
Read more >
Installation and Getting Started - pyQuil - Rigetti Computing
This will allow you to run your programs on the Rigetti QVM or QPU. Sign up here to get a Forest API key,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found