Skip to content

Python 3.12: "module 'collections' has no attribute 'MutableSet'"Β #98

@windemut

Description

@windemut

Got this error during the second install command. It's probably related to recent version of Python.

 % python -m hrequests install  

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/hrequests/__init__.py", line 33, in <module>
    from .session import Session, TLSSession, chrome, firefox
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/hrequests/session.py", line 5, in <module>
    from browserforge.headers import Browser as BFConstraints
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/browserforge/headers/__init__.py", line 3, in <module>
    DownloadIfNotExists()
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/browserforge/download.py", line 159, in DownloadIfNotExists
    Download()
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/browserforge/download.py", line 150, in Download
    asyncio.run(AsyncDownload(headers=headers, fingerprints=fingerprints))
  File "/opt/homebrew/Cellar/python@3.12/3.12.10_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.10_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.10_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/browserforge/download.py", line 145, in AsyncDownload
    await downloader.download(headers=headers, fingerprints=fingerprints)
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/browserforge/download.py", line 124, in download
    async with httpx.AsyncClient() as session:
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpx/_client.py", line 1402, in __init__
    self._transport = self._init_transport(
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpx/_client.py", line 1445, in _init_transport
    return AsyncHTTPTransport(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpx/_transports/default.py", line 294, in __init__
    import httpcore
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpcore/__init__.py", line 1, in <module>
    from ._api import request, stream
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpcore/_api.py", line 7, in <module>
    from ._sync.connection_pool import ConnectionPool
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpcore/_sync/__init__.py", line 8, in <module>
    from .http2 import HTTP2Connection
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/httpcore/_sync/http2.py", line 10, in <module>
    import h2.connection
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/h2/connection.py", line 13, in <module>
    from hyperframe.frame import (
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/hyperframe/frame.py", line 17, in <module>
    from .flags import Flag, Flags
  File "/Users/me/code/platform/.gx/lib/python3.12/site-packages/hyperframe/flags.py", line 14, in <module>
    class Flags(collections.MutableSet):
                ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableSet'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions