oremanj / python-netfilterqueue

Python bindings for libnetfilter_queue
MIT License
246 stars 96 forks source link

Unable to install package #90

Open rickgds80 opened 2 years ago

rickgds80 commented 2 years ago

when install by: pip install NetfilterQueue

I receive this error: sysconfig_schemes = _load_sysconfig_schemes() or {} File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/install.py", line 91, in _load_sysconfig_schemes with contextlib.suppress(AttributeError): File "/usr/lib/python3.10/contextlib.py", line 436, in exit return exctype is not None and issubclass(exctype, self._exceptions) RecursionError: maximum recursion depth exceeded in subclasscheck [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for NetfilterQueue Failed to build NetfilterQueue
ERROR: Could not build wheels for NetfilterQueue, which is required to install pyproject.toml-based projects

vembacher commented 2 years ago

I've had the same issue, do you also use KaliLinux? I had this issue happening for me when using the kalilinux/kali-rolling Docker image.

Rolling back the NetfilterQueue version to commit afcee0d9bfbe377b4e376ca44d3bf8f3e7b2bcad fixed it for me. I did not check every newer commit, but most newer ones failed to build. So you could try building from the git repo, or find a version you can install from PyPI.

So taking the commit (a5578d3122a9e37001c76a8cd02f7c026b48ccf9) directly after afcee0d9bfbe377b4e376ca44d3bf8f3e7b2bcad I observed the following:

This fails (using a Kali docker image):

FROM kalilinux/kali-rolling

RUN apt-get update && \
    apt-get install --no-install-recommends --no-install-suggests -y \
      build-essential \
      python3-dev python2-dev python3-pip \
      libnetfilter-queue-dev  \
      git && \
    pip3 install cython && \
    git clone https://github.com/oremanj/python-netfilterqueue && \
    cd python-netfilterqueue && \
    git checkout a5578d3122a9e37001c76a8cd02f7c026b48ccf9 && \
    pip install .

But this succeeds (using a debian docker image):

FROM debian:stable-20220509-slim

RUN apt-get update && \
    apt-get install --no-install-recommends --no-install-suggests -y \
      build-essential \
      python3-dev python2-dev python3-pip \
      libnetfilter-queue-dev  \
      git && \
    pip3 install cython && \
    git clone https://github.com/oremanj/python-netfilterqueue && \
    cd python-netfilterqueue && \
    git checkout a5578d3122a9e37001c76a8cd02f7c026b48ccf9 && \
    pip install .

Even though both are building from the same commit. The same behavior happens with the newest commit (0bb948d2c196f033dbb54aca6bcf24eacb14bf7f) on the master branch.

Encryptedkvng commented 11 months ago

python -m pip install netfilterqueue Collecting netfilterqueue Using cached NetfilterQueue-1.1.0.tar.gz (90 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: netfilterqueue Building wheel for netfilterqueue (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for netfilterqueue (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [29 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\netfilterqueue copying netfilterqueue_version.py -> build\lib.win-amd64-cpython-311\netfilterqueue copying netfilterqueue__init__.py -> build\lib.win-amd64-cpython-311\netfilterqueue running egg_info writing NetfilterQueue.egg-info\PKG-INFO writing dependency_links to NetfilterQueue.egg-info\dependency_links.txt writing top-level names to NetfilterQueue.egg-info\top_level.txt reading manifest file 'NetfilterQueue.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'NetfilterQueue.egg-info\SOURCES.txt' copying netfilterqueue_impl.pxd -> build\lib.win-amd64-cpython-311\netfilterqueue copying netfilterqueue_impl.pyi -> build\lib.win-amd64-cpython-311\netfilterqueue copying netfilterqueue_impl.pyx -> build\lib.win-amd64-cpython-311\netfilterqueue copying netfilterqueue\py.typed -> build\lib.win-amd64-cpython-311\netfilterqueue running build_ext building 'netfilterqueue._impl' extension creating build\temp.win-amd64-cpython-311 creating build\temp.win-amd64-cpython-311\Release creating build\temp.win-amd64-cpython-311\Release\netfilterqueue "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcnetfilterqueue/_impl.c /Fobuild\temp.win-amd64-cpython-311\Release\netfilterqueue/_impl.obj _impl.c netfilterqueue/_impl.c(1166): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for netfilterqueue Failed to build netfilterqueue ERROR: Could not build wheels for netfilterqueue, which is required to install pyproject.toml-based projects

SamokhinMark commented 10 months ago

To resolve this issue, you need to install the necessary dependencies and libraries for netfilterqueue

sudo apt-get install libnetfilter-queue-dev

and after try to install with pip

pip3 install netfilterqueue