Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.99k stars 1.7k forks source link

ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.11/collections/__init__.py) #2280

Closed NEX-S closed 11 months ago

NEX-S commented 1 year ago
Python 3.11.5 (main, Aug 29 2023, 15:31:31) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nex/.local/lib/python3.11/site-packages/pwn/__init__.py", line 4, in <module>
    from pwn.toplevel import *
  File "/home/nex/.local/lib/python3.11/site-packages/pwn/toplevel.py", line 22, in <module>
    from pwnlib import *
  File "/home/nex/.local/lib/python3.11/site-packages/pwnlib/dynelf.py", line 55, in <module>
    from elftools.elf.enums import ENUM_D_TAG
  File "/home/nex/.local/lib/python3.11/site-packages/elftools/elf/enums.py", line 9, in <module>
    from ..construct import Pass
  File "/home/nex/.local/lib/python3.11/site-packages/elftools/construct/__init__.py", line 33, in <module>
    from .core import *
  File "/home/nex/.local/lib/python3.11/site-packages/elftools/construct/core.py", line 3, in <module>
    from .lib.py3compat import BytesIO, advance_iterator, bchr
  File "/home/nex/.local/lib/python3.11/site-packages/elftools/construct/lib/__init__.py", line 4, in <module>
    from .container import (Container, FlagsContainer, ListContainer,
  File "/home/nex/.local/lib/python3.11/site-packages/elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.11/collections/__init__.py)
peace-maker commented 1 year ago

This appears to be fixed https://github.com/eliben/pyelftools/commit/923c498fd2c3c9805c613f8ac33e5572b9a784e2 in pyelftools 0.26 from 2019 already. You're running a really old version. Try updating using pip install -U pyelftools.

How did you install pwntools? We should bump our min. required version it looks like.

NEX-S commented 11 months ago

This appears to be fixed eliben/pyelftools@923c498 in pyelftools 0.26 from 2019 already. You're running a really old version. Try updating using pip install -U pyelftools.

How did you install pwntools? We should bump our min. required version it looks like.

This works!!!

env: Kali Linux Latest. using: python3 -m pip install pwntools