This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 8 months ago.
I upgraded my python to version 3.10, but when I was installing dependencies for one of my projects (which worked fine before), I got this error from hiredis (hiredis==2.0.0):
ERROR: Command errored out with exit status 1:
command: /home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-11hzakag
cwd: /tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/
Complete output (27 lines):
/tmp/pip-install-pp4tya0l/hiredis_77cc0a3cc0244a81bdc153910e791620/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import sys, imp, os, glob, io
/home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/lib/python3.10/site-packages/setuptools/dist.py:691: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/hiredis
copying hiredis/__init__.py -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/version.py -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/hiredis.pyi -> build/lib.linux-x86_64-3.10/hiredis
copying hiredis/py.typed -> build/lib.linux-x86_64-3.10/hiredis
running build_ext
building 'hiredis.hiredis' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/src
creating build/temp.linux-x86_64-3.10/vendor
creating build/temp.linux-x86_64-3.10/vendor/hiredis
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ivendor -I/home/sajad/com/nilva/codebase/nilmal/nilmal-django-backend/venv/include -I/usr/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-3.10/src/hiredis.o
In file included from src/hiredis.c:1:
src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
4 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for hiredis
I'm not sure what the problem is, could anyone help?
if your version of python is 3.9 :
py -3.9 -m pip install --upgrade pip
py -3.9 -m pip install hiredis
that work for me if doesnt work try :
py -3.9 -m pip uninstall hiredis
Related
Why do I always get this error when I try to install accumulation-tree? I need this for optbinning. A similar package would also be a solution.
ERROR: Command errored out with exit status 1:
command: /Users/elisaderoo/opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yc/59hh1mg16c90lpnfsfvwcnf80000gn/T/pip-install-29thp5kc/accumulation-tree/setup.py'"'"'; __file__='"'"'/private/var/folders/yc/59hh1mg16c90lpnfsfvwcnf80000gn/T/pip-install-29thp5kc/accumulation-tree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/yc/59hh1mg16c90lpnfsfvwcnf80000gn/T/pip-wheel-4djg7a0d
cwd: /private/var/folders/yc/59hh1mg16c90lpnfsfvwcnf80000gn/T/pip-install-29thp5kc/accumulation-tree/
Complete output (19 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/accumulation_tree
copying accumulation_tree/treeslice.py -> build/lib.macosx-10.9-x86_64-3.8/accumulation_tree
copying accumulation_tree/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/accumulation_tree
copying accumulation_tree/abctree.py -> build/lib.macosx-10.9-x86_64-3.8/accumulation_tree
running build_ext
cythoning accumulation_tree/accumulation_tree.pyx to accumulation_tree/accumulation_tree.c
/Users/elisaderoo/opt/anaconda3/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/yc/59hh1mg16c90lpnfsfvwcnf80000gn/T/pip-install-29thp5kc/accumulation-tree/accumulation_tree/accumulation_tree.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'accumulation_tree.accumulation_tree' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/accumulation_tree
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/elisaderoo/opt/anaconda3/include -arch x86_64 -I/Users/elisaderoo/opt/anaconda3/include -arch x86_64 -I/Users/elisaderoo/opt/anaconda3/include/python3.8 -c accumulation_tree/accumulation_tree.c -o build/temp.macosx-10.9-x86_64- 3.8/accumulation_tree/accumulation_tree.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for accumulation-tree
This error might be due to not having Cython installed. Alternatively, you can clone the repository from GitHub, remove the dependency tdigest from the list of install_requires in setup.py, and install from the source using python setup.py install.
Try running (in a terminal window)
xcode-select –install
(and clicking through dialog)
If that doesn't work try:
sudo xcode-select --reset
Several links show this problem in other contexts (e.g.)
https://developer.apple.com/forums/thread/673827
Fatal Error (invalid active developer path ) After Upgrading R / R Studio
you may not have installed gfortran
first try to install it
sudo apt install gfortran
I had a freash installation of pop os, installed pip and I updated everything usig the following command
sudo apt update
sudo apt upgrade
now I want to install the pynput module so I tried the following command
pip install pynput
But I got the following error
Collecting pynput
Using cached pynput-1.7.3-py2.py3-none-any.whl (99 kB)
Collecting evdev>=1.3; "linux" in sys_platform
Using cached evdev-1.4.0.tar.gz (26 kB)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pynput) (1.15.0)
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in /usr/lib/python3/dist-packages (from pynput) (0.27)
Building wheels for collected packages: evdev
Building wheel for evdev (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x6x_dhp2/evdev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-98m4gy5x
cwd: /tmp/pip-install-x6x_dhp2/evdev/
Complete output (29 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.8/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.8/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/evdev
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c evdev/input.c -o build/temp.linux-x86_64-3.8/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
evdev/input.c:10:10: fatal error: Python.h: No such file or directory
10 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for evdev
Running setup.py clean for evdev
Failed to build evdev
Installing collected packages: evdev, pynput
Running setup.py install for evdev ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
What to do now?
I was having trouble installing a package (plumed) using pip3.6. Specifically, with the command pip3.6 install --user plumed, I got the following error:
Collecting plumed
Using cached plumed-2.6.1.tar.gz (189 kB)
Building wheels for collected packages: plumed
Building wheel for plumed (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-js3bt49u
cwd: /tmp/pip-install-cnvim96k/plumed/
Complete output (17 lines):
Module name plumed
Version number 2.6.1
using available plumed.cpp file
running bdist_wheel
running build
running build_ext
building 'plumed' extension
creating build
creating build/temp.linux-x86_64-3.6
/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC -I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
In file included from /usr/include/python3.6m/Python.h:8:0,
from plumed.cpp:31:
/usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
# include <x86_64-linux-gnu/python3.6m/pyconfig.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for plumed
Running setup.py clean for plumed
Failed to build plumed
Installing collected packages: plumed
Running setup.py install for plumed ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed
cwd: /tmp/pip-install-cnvim96k/plumed/
Complete output (17 lines):
Module name plumed
Version number 2.6.1
using available plumed.cpp file
running install
running build
running build_ext
building 'plumed' extension
creating build
creating build/temp.linux-x86_64-3.6
/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC
-I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
In file included from /usr/include/python3.6m/Python.h:8:0,
from plumed.cpp:31:
/usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
# include <x86_64-linux-gnu/python3.6m/pyconfig.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed Check the logs for full command output.
I know that there are already a lot of relevant discussions on the forum, but none of the solutions worked for me. I've tried the following solutions:
sudo apt-get install python-dev libxml2-dev libxslt-dev
sudo apt-get install python3.6-dev
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h
The weird thing is that I had pyconfig.h in /usr/include/x86_64-linux-gnu/python3.6m/ but it couldn't be found when I used pip3.6. I was using Ubuntu 18.04, so the systematic pip was associated with Python 3.6.9. I'm wondering if there is any solution that could deal with this problem. Thanks!
For me it turned out an old package wasn't fully installed somewhere. If you get apt-get -f install anywhere in your error messages, just run that, it'll re-install your packages. Not 100% certain it'll work for everyone, but that was my specific problem with this.
root#kali:/home/kali/Desktop# pip install NetfilterQueue
Collecting NetfilterQueue
Using cached NetfilterQueue-0.8.1.tar.gz (58 kB)
Building wheels for collected packages: NetfilterQueue
Building wheel for NetfilterQueue (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-v0vd42ah
cwd: /tmp/pip-install-6ltnc7gf/netfilterqueue/
Complete output (13 lines):
running bdist_wheel
running build
running build_ext
skipping 'netfilterqueue.c' Cython extension (up-to-date)
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.8
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c netfilterqueue.c -o build/temp.linux-x86_64-3.8/netfilterqueue.o
netfilterqueue.c:437:10: fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
437 | #include "libnfnetlink/linux_nfnetlink.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for NetfilterQueue
Running setup.py clean for NetfilterQueue
Failed to build NetfilterQueue
DEPRECATION: Could not build wheels for NetfilterQueue which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: NetfilterQueue
Running setup.py install for NetfilterQueue ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qodwn5k_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/NetfilterQueue
cwd: /tmp/pip-install-6ltnc7gf/netfilterqueue/
Complete output (13 lines):
running install
running build
running build_ext
skipping 'netfilterqueue.c' Cython extension (up-to-date)
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.8
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c netfilterqueue.c -o build/temp.linux-x86_64-3.8/netfilterqueue.o
netfilterqueue.c:437:10: fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
437 | #include "libnfnetlink/linux_nfnetlink.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6ltnc7gf/netfilterqueue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qodwn5k_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/NetfilterQueue Check the logs for full command output.
I tried apt-get install build-essential python3-dev libnetfilter-queue-dev
but then i get
root#kali:/home/kali/Desktop# apt-get install build-essential python3-dev libnetfilter-queue-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libnetfilter-queue-dev
i'm trying to install netfilterqueue library for python3 but i cant install netfilter queue, any help? ive tried installing livnetfilter queue but it also doesn't work, ive searched online and i couldn't find anything. whats the problem
After researching a lot in this area, I find that scapy does not work well in python-python2 and netfilterqueue does not work well in python3, without downgrading the language I can achieve this, I recommend you to correct any additional error, execute << dpkg - configure -a >> and then << apt-get update >>, because this version is unattended and can generate broken packages in your repository list
apt install python3-pip git libnfnetlink-dev libnetfilter-queue-dev
pip3 install -U git+https://github.com/kti/python-netfilterqueue
hello first install netfilterqueue on your linux machine
sudo apt install libnfnetlink-dev libnetfilter-queue-dev
then you should know netfilterqueue for python3+ is named nfqp3 so install it with
pip3 install nfqp3
it is worth mentioning that when importing it in a python script you should import it as netfilterqueue not nfqp3
To install from source:
$ git clone git#github.com:kti/python-netfilterqueue.git
cd python-netfilterqueue
python setup.py install
pip install https://github.com/johnteslade/python-netfilterqueue/archive/refs/heads/update-cython-code.zip
it will work by this command 100%
This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 2 years ago.
I am trying to upgrade pycairo package but getting following error:
$ python3 -m pip install -U pycairo
Defaulting to user installation because normal site-packages is not writeable
Collecting pycairo
Using cached pycairo-1.19.1.tar.gz (205 kB)
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-21711no1/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/abcde/.local/include/python3.7m/pycairo
cwd: /tmp/pip-install-ho1du2qw/pycairo/
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.7/cairo
running build_ext
building 'cairo._cairo' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cairo
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=19 -DPYCAIRO_VERSION_MICRO=1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/python3.7m -c cairo/device.c -o build/temp.linux-x86_64-3.7/cairo/device.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
cairo/device.c:30:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ho1du2qw/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-21711no1/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/abcde/.local/include/python3.7m/pycairo Check the logs for full command output.
Where is the problem?
File Python.h means you have to install python-dev with C/C++ headers .h because it has to compile some C/C++ code.
On Linux Mint/Ubuntu/Debian it could be one of this command
apt install python-dev
apt install python3-dev
apt install python3.7-dev