Skip to content

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

Description

$ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure.IdentityClientThis issue points to a problem in the data-plane of the library.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions