Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python ModuleNotFoundError: No module named 'elftools.common.py3compat'

PC: windows 11 wsl 2, ubuntu-22.04

I was gonna install 'pwntools' by following these instructions

apt-get update
apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools

after installing i tested it. And this happened.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kimminjun514/.local/lib/python3.10/site-packages/pwn/__init__.py", line 4, in <module>
    from pwn.toplevel import *
  File "/home/kimminjun514/.local/lib/python3.10/site-packages/pwn/toplevel.py", line 23, in <module>
    from pwnlib import *
  File "/home/kimminjun514/.local/lib/python3.10/site-packages/pwnlib/dynelf.py", line 57, in <module>
    from pwnlib import elf
  File "/home/kimminjun514/.local/lib/python3.10/site-packages/pwnlib/elf/__init__.py", line 9, in <module>
    from pwnlib.elf.corefile import Core
  File "/home/kimminjun514/.local/lib/python3.10/site-packages/pwnlib/elf/corefile.py", line 79, in <module>
    from elftools.common.py3compat import bytes2str
ModuleNotFoundError: No module named 'elftools.common.py3compat'

What's going on with my computer? Do I have to buy a new computer?

I've tried a lot of things. I deleted WSL and reinstalled it. But that didn't work.

I've googled thousand of times but i'm still stuck with this problem.

like image 893
MinJun Avatar asked Oct 11 '25 16:10

MinJun


1 Answers

Check whether the version of pyelftools is 0.30, after the test, the version of 0.29 will not report errors, so choose to uninstall the current version and replace the old version

pip uninstall pyelftools -y
pip install pyelftools==0.29

I hope you found this useful!

like image 160
hyrink Aslar Avatar answered Oct 14 '25 05:10

hyrink Aslar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!