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.

2

1 Answer

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!

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like