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

AttributeError: module 'site' has no attribute 'getsitepackages' #8573

Closed
chlowell opened this issue Nov 11, 2019 · 1 comment
Closed

AttributeError: module 'site' has no attribute 'getsitepackages' #8573

chlowell opened this issue Nov 11, 2019 · 1 comment
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.

Comments

@chlowell
Copy link
Contributor

chlowell commented Nov 11, 2019

$ python
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site.py", line 791, in <module>
    main()
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site.py", line 768, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site.py", line 280, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site.py", line 211, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site.py", line 179, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "C:\Users\chlowe\.virtualenvs\misc-37\lib\site-packages\win32\lib\pywin32_bootstrap.py", line 14, in <module>
    for maybe in site.getsitepackages():
AttributeError: module 'site' has no attribute 'getsitepackages'

This originates with pywin32 release 226 (issue there is mhammond/pywin32#1439). A workaround is to manually remove release 226 and replace it with 225, or explicitly install a prior version in a new virtual environment:

pip install pywin32==225 azure-identity
@chlowell chlowell added Azure.Identity Client This issue points to a problem in the data-plane of the library. and removed triage labels Nov 11, 2019
rayluo added a commit to AzureAD/microsoft-authentication-extensions-for-python that referenced this issue Nov 11, 2019
This is a temporary workaround to help address a downstream issue
Azure/azure-sdk-for-python#8573
@chlowell
Copy link
Contributor Author

Closing this as resolved: portalocker 1.5.2 excludes pywin32 226, and pywin32 227 includes a fix.

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