Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.8 win32: DefaultAzureCredential and SharedTokenCacheCredential raise ImportError #8292

Closed
chlowell opened this issue Oct 30, 2019 · 2 comments
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.

Comments

@chlowell
Copy link
Member

chlowell commented Oct 30, 2019

Initializers of DefaultAzureCredential and SharedTokenCacheCredential raise ImportError when running Python 3.8 on Windows:

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from azure.identity import DefaultAzureCredential
>>> DefaultAzureCredential()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\3.8\lib\site-packages\azure\identity\_credentials\default.py", line 39, in __init__
    SharedTokenCacheCredential(
  File "C:\3.8\lib\site-packages\azure\identity\_credentials\user.py", line 136, in __init__
    from msal_extensions.token_cache import WindowsTokenCache
  File "C:\3.8\lib\site-packages\msal_extensions\__init__.py", line 7, in <module>
    from .token_cache import WindowsTokenCache as TokenCache
  File "C:\3.8\lib\site-packages\msal_extensions\token_cache.py", line 8, in <module>
    from .cache_lock import CrossPlatLock
  File "C:\3.8\lib\site-packages\msal_extensions\cache_lock.py", line 5, in <module>
    import portalocker
  File "C:\3.8\lib\site-packages\portalocker\__init__.py", line 4, in <module>
    from . import portalocker
  File "C:\3.8\lib\site-packages\portalocker\portalocker.py", line 9, in <module>
    import win32file
ImportError: DLL load failed while importing win32file: The specified module could not be found.

No other credential is affected, so this can be worked around by substituting a specific component of DefaultAzureCredential such as ClientSecretCredential or EnvironmentCredential. SharedTokenCacheCredential, however, won't function on Python 3.8.

The cause of this is tracked at mhammond/pywin32#1431

@chlowell chlowell added Azure.Identity Client This issue points to a problem in the data-plane of the library. labels Oct 30, 2019
@chlowell chlowell self-assigned this Oct 30, 2019
@chlowell
Copy link
Member Author

chlowell commented Nov 7, 2019

Update: with #8294, DefaultAzureCredential doesn't access the shared token cache on 3.8/win32 but otherwise functions normally. SharedTokenCacheCredential continues to raise ImportError on 3.8/win32.

@chlowell
Copy link
Member Author

The most recent pywin32 package included a fix for the root cause of this. The shared cache should be accessible on 3.8 with pywin32 227 installed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

1 participant