简体   繁体   中英

Unable to install pwn package for python

I am trying to install the pwn library on my MacBook Air (M2, 2022) but it's failing while building the wheel for unicorn. I'm using python version 3.10.6.

This is the command I'm using: python3 -m pip install --upgrade pwn without the --upgrade part I still get the same error message. If I replace pwn with pwntools I still get the same error message as well.

wtdcode stated in the GitHub issue: "Due to the fact that GitHub doesn't provide an M1 CI (actions/runner-images#2187), there is no available PyPI release yet. You may build it by yourself."

So my question is, How do I build it myself?

error msg:

     Building wheel for unicorn (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      running bdist_wheel
      running build
      Building C extensions
      error: [Errno 2] No such file or directory: '/private/var/folders/6d/85dtjcrj57173csw50tk8r300000gn/T/pip-install-o33_11sd/unicorn_530dd415f77a40418edfdec7c2d599f2/../../include/unicorn'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for unicorn
  Running setup.py clean for unicorn
Successfully built psutil
Failed to build unicorn
Installing collected packages: unicorn, pyserial, pyelftools, rpyc, ropgadget, requests, python-dateutil, pysocks, psutil, pathlib2, packaging, mako, intervaltree, colored-traceback, paramiko, pwntools, pwn
  Running setup.py install for unicorn ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for unicorn did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      running install
      running build
      Building C extensions
      error: [Errno 2] No such file or directory: '/private/var/folders/6d/85dtjcrj57173csw50tk8r300000gn/T/pip-install-o33_11sd/unicorn_530dd415f77a40418edfdec7c2d599f2/../../include/unicorn'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> unicorn

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Thank you for your help.

I have an M1 mac and had the same issue—nothing worked for me either, so I eventually just tried installing an older version of unicorn (if you do pip install unicorn== without specifying the version, you can list all of them), and tried different ones until one worked.

(For me, this was just downgrading to 2.0.0 )

According to official pwntools documentation , you need building binutils from source. They did make things easy with homebrew :

brew install https://raw.githubusercontent.com/Gallopsled/pwntools-binutils/master/macos/binutils-$ARCH.rb

In order to be able to call the library from Python interpreter, an extra step for me was to use the virtualenv:

source /opt/homebrew/Cellar/pwntools/{PWNTOOLS_VERSION}/libexec/bin/activate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM