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.

AttributeError: 'CredentialAdaptor' object has no attribute '_token_retriever'

See original GitHub issue
  • Package Name: azure-core
  • Package Version: 1.21.1
  • Operating System: macOS Monterey
  • Python Version: 3.9

Describe the bug Deploying a ray cluster to azure fails with an internal credential error in the Azure core commons package.

To Reproduce Following the Azure guide at https://docs.ray.io/en/latest/cluster/cloud.html

Steps to reproduce the behavior:

  1. Configure the ray deployment for Azure
  2. Run ray up azure-example-full.yaml
  3. Fail AttributeError: 'CredentialAdaptor' object has no attribute '_token_retriever'

Expected behavior No internal error.

Logs

Traceback (most recent call last):
  File "/Users/mickare/git/raydemo/venv/bin/ray", line 8, in <module>
    sys.exit(main())
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/scripts/scripts.py", line 1989, in main
    return cli()
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/scripts/scripts.py", line 971, in up
    create_or_update_cluster(
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/autoscaler/_private/commands.py", line 233, in create_or_update_cluster
    config = _bootstrap_config(config, no_config_cache=no_config_cache)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/autoscaler/_private/commands.py", line 316, in _bootstrap_config
    resolved_config = provider_cls.bootstrap_config(config)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/autoscaler/_private/_azure/node_provider.py", line 309, in bootstrap_config
    return bootstrap_azure(cluster_config)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/autoscaler/_private/_azure/config.py", line 22, in bootstrap_azure
    config = _configure_resource_group(config)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/ray/autoscaler/_private/_azure/config.py", line 58, in _configure_resource_group
    resource_client.resource_groups.create_or_update(
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/mgmt/resource/resources/v2021_04_01/operations/_resource_groups_operations.py", line 154, in create_or_update
    pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 211, in run
    return first_node.send(pipeline_request)  # type: ignore
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 71, in send
    response = self.next.send(request)
  [Previous line repeated 2 more times]
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/mgmt/core/policies/_base.py", line 47, in send
    response = self.next.send(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/policies/_redirect.py", line 158, in send
    response = self.next.send(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/policies/_retry.py", line 445, in send
    response = self.next.send(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/policies/_authentication.py", line 117, in send
    self.on_request(request)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/core/pipeline/policies/_authentication.py", line 94, in on_request
    self._token = self._credential.get_token(*self._scopes)
  File "/Users/mickare/git/raydemo/venv/lib/python3.9/site-packages/azure/common/credentials.py", line 72, in get_token
    _, token, fulltoken = credentials._token_retriever()  # pylint:disable=protected-access
AttributeError: 'CredentialAdaptor' object has no attribute '_token_retriever'

Additional context It seems that the commons’ credential class is expecting another type from the internal _cred_dict dictionary? Maybe a type check is missing?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mario-s-duartecommented, Dec 9, 2021

@mickare I advise you to also report the issue in the ray project.

I was able to find a work around by installing and older version of azure-cli and azure-core. pip install -U azure-cli==2.18.0 azure-core==1.10.0

You should also update the azure “imageVersion” to new ones.

0reactions
mickarecommented, Dec 10, 2021

@xiangyan99 I didn’t see that it was deprecated. Please mark deprecated methods. E.g. use a @deprecated annotation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'ServicePrincipalCredentials' object has no ...
While Running Chaos Toolkit Azure related Playbooks , i am getting an error as " failed: AttributeError: 'ServicePrincipalCredentials' ...
Read more >
Azure SDK for Python - Gitter
I am using azure-storage-file-datalake package to connect with ADLS gen2 ... _scopes) AttributeError: 'AzureSasCredential' object has no attribute ...
Read more >
i am getting an error as failed: AttributeError - Anycodings.com
Answers 1 : of i am getting an error as failed: AttributeError: ServicePrincipalCredentials object has no attribute get_token · Azure SDK for ...
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