microsoft / solution-accelerator-many-models

MIT License
192 stars 87 forks source link

DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode(). #134

Open anderl80 opened 3 years ago

anderl80 commented 3 years ago

Executing the data preparation notebook on the created AML CI (following instructions) cell 6 (Workspace.from_config) runs into:

---------------------------------------------------------------------------
DecodeError                               Traceback (most recent call last)
/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in wrapper(self, *args, **kwargs)
    288                     module_logger.debug("{} acquired lock in {} s.".format(type(self).__name__, duration))
--> 289                 return test_function(self, *args, **kwargs)
    290             except Exception as e:

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_all_subscription_ids_internal(self, arm_token)
    516         if isinstance(self._ambient_auth, AbstractAuthentication):
--> 517             return self._ambient_auth._get_all_subscription_ids()
    518         else:

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_all_subscription_ids(self)
   1652         from azureml._base_sdk_common.common import fetch_tenantid_from_aad_token
-> 1653         token_tenant_id = fetch_tenantid_from_aad_token(arm_token)
   1654         return _get_subscription_ids_via_client(msi_auth), token_tenant_id

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/_base_sdk_common/common.py in fetch_tenantid_from_aad_token(token)
    115     # verify signature, we just need the tenant id.
--> 116     decode_json = jwt.decode(token, verify=False)
    117     return decode_json['tid']

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/jwt/api_jwt.py in decode(self, jwt, key, algorithms, options, **kwargs)
    118     ) -> Dict[str, Any]:
--> 119         decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
    120         return decoded["payload"]

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/jwt/api_jwt.py in decode_complete(self, jwt, key, algorithms, options, **kwargs)
     85         if options["verify_signature"] and not algorithms:
---> 86             raise DecodeError(
     87                 'It is required that you pass in a value for the "algorithms" argument when calling decode().'

DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().

During handling of the above exception, another exception occurred:

DecodeError                               Traceback (most recent call last)
<ipython-input-6-4fbcce1fbdc9> in <module>
      1 from azureml.core.workspace import Workspace
      2 
----> 3 ws = Workspace.from_config()
      4 
      5 # Take a look at Workspace

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/workspace.py in from_config(path, auth, _logger, _file_name)
    278 
    279         _logger.info('Found the config file in: %s', found_path)
--> 280         return Workspace.get(
    281             workspace_name,
    282             auth=auth,

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/workspace.py in get(name, auth, subscription_id, resource_group)
    546             return workspace_from_auth
    547 
--> 548         result_dict = Workspace.list(
    549             subscription_id, auth=auth, resource_group=resource_group)
    550         result_dict = {k.lower(): v for k, v in result_dict.items()}

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/workspace.py in list(subscription_id, auth, resource_group)
    636                     auth, workspaces_list, result_dict)
    637         elif subscription_id and resource_group:
--> 638             workspaces_list = Workspace._list_legacy(
    639                 auth, subscription_id=subscription_id, resource_group_name=resource_group)
    640 

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/workspace.py in _list_legacy(auth, subscription_id, resource_group_name, ignore_error)
   1373                 return None
   1374             else:
-> 1375                 raise e
   1376 
   1377     @staticmethod

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/workspace.py in _list_legacy(auth, subscription_id, resource_group_name, ignore_error)
   1366             # A list of object of
   1367             # azureml._base_sdk_common.workspace.models.workspace.Workspace
-> 1368             workspace_autorest_list = _commands.list_workspace(
   1369                 auth, subscription_id=subscription_id, resource_group_name=resource_group_name)
   1370             return workspace_autorest_list

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/_project/_commands.py in list_workspace(auth, subscription_id, resource_group_name)
    387         if resource_group_name:
    388             list_object = WorkspacesOperations.list_by_resource_group(
--> 389                 auth._get_service_client(AzureMachineLearningWorkspaces, subscription_id).workspaces,
    390                 resource_group_name)
    391             workspace_list = list_object.value

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_service_client(self, client_class, subscription_id, subscription_bound, base_url)
    155         # in the multi-tenant case, which causes confusion.
    156         if subscription_id:
--> 157             all_subscription_list, tenant_id = self._get_all_subscription_ids()
    158             self._check_if_subscription_exists(subscription_id, all_subscription_list, tenant_id)
    159 

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_all_subscription_ids(self)
    498         """
    499         arm_token = self._get_arm_token()
--> 500         return self._get_all_subscription_ids_internal(arm_token)
    501 
    502     def _get_workspace(self, subscription_id, resource_group, name):

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in wrapper(self, *args, **kwargs)
    293                     InteractiveLoginAuthentication(force=True, tenant_id=self._tenant_id)
    294                     # Try one more time
--> 295                     return test_function(self, *args, **kwargs)
    296                 else:
    297                     raise e

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_all_subscription_ids_internal(self, arm_token)
    515     def _get_all_subscription_ids_internal(self, arm_token):
    516         if isinstance(self._ambient_auth, AbstractAuthentication):
--> 517             return self._ambient_auth._get_all_subscription_ids()
    518         else:
    519             from azureml._vendor.azure_cli_core._profile import Profile

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/core/authentication.py in _get_all_subscription_ids(self)
   1651         arm_token = self._get_arm_token()
   1652         from azureml._base_sdk_common.common import fetch_tenantid_from_aad_token
-> 1653         token_tenant_id = fetch_tenantid_from_aad_token(arm_token)
   1654         return _get_subscription_ids_via_client(msi_auth), token_tenant_id
   1655 

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/azureml/_base_sdk_common/common.py in fetch_tenantid_from_aad_token(token)
    114     # We set verify=False, as we don't have keys to verify signature, and we also don't need to
    115     # verify signature, we just need the tenant id.
--> 116     decode_json = jwt.decode(token, verify=False)
    117     return decode_json['tid']
    118 

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/jwt/api_jwt.py in decode(self, jwt, key, algorithms, options, **kwargs)
    117         **kwargs,
    118     ) -> Dict[str, Any]:
--> 119         decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
    120         return decoded["payload"]
    121 

/anaconda/envs/azureml_py38/lib/python3.8/site-packages/jwt/api_jwt.py in decode_complete(self, jwt, key, algorithms, options, **kwargs)
     84 
     85         if options["verify_signature"] and not algorithms:
---> 86             raise DecodeError(
     87                 'It is required that you pass in a value for the "algorithms" argument when calling decode().'
     88             )

DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().
anderl80 commented 3 years ago

Related? https://github.com/Azure/azure-sdk-for-python/issues/16035

anderl80 commented 3 years ago

Seems that is automatically downgraded with the installation of opendataset..

Installing collected packages: azure-mgmt-resource
  Attempting uninstall: azure-mgmt-resource
    Found existing installation: azure-mgmt-resource 18.0.0
    Uninstalling azure-mgmt-resource-18.0.0:
      Successfully uninstalled azure-mgmt-resource-18.0.0
Successfully installed azure-mgmt-resource-10.2.0
Note: you may need to restart the kernel to use updated packages.

pip install update azure-mgmt-resource resolves the issue.