Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

  1. #1
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Hello!

    I'm trying to install python-pcapy lib vresion 0.10.10 from
    Code:
    pip install pcapy
    .

    Packages: setuptools, python-devel, gcc-c++, libpcap-devel are already installed.

    So, let's run "pip install pcapy" command:

    Code:
    k_mikhail@linux-mk500:~> sudo pip install pcapy
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy ... error
        Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-it62ew3l/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-783c4f7n-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_ext
        building 'pcapy' extension
        creating build
        creating build/temp.linux-x86_64-3.4
        gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python3.4m -c pcapdumper.cc -o build/temp.linux-x86_64-3.4/pcapdumper.o
        pcapdumper.cc:10:20: fatal error: Python.h: Нет такого файла или каталога
         #include <Python.h>
                            ^
        compilation terminated.
        error: command 'gcc' failed with exit status 1
        
        ----------------------------------------
    Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-it62ew3l/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-783c4f7n-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-it62ew3l/pcapy/
    Ok, let's try "find / -name Python.h 2>/dev/null" command:

    Code:
    /usr/include/python2.7/Python.h
    I've tried the same installation via pip on ALT Linux -- everything works fine. Ok, I can install python-pcapy from devel:languageython repo, but here is 0.10.5 version, which is very old. Please, help to resolve this. Thanks!

  2. #2
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    At the same time manual compilation works fine:
    Code:
    k_mikhail@linux-mk500:~> sudo python setup.py install
    running install
    running bdist_egg
    running egg_info
    writing pcapy.egg-info/PKG-INFO
    writing top-level names to pcapy.egg-info/top_level.txt
    writing dependency_links to pcapy.egg-info/dependency_links.txt
    reading manifest file 'pcapy.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pcapy.egg-info/SOURCES.txt'
    installing library code to build/bdist.linux-x86_64/egg
    running install_lib
    running build_ext
    creating build/bdist.linux-x86_64/egg
    copying build/lib.linux-x86_64-2.7/pcapy.so -> build/bdist.linux-x86_64/egg
    creating stub loader for pcapy.so
    byte-compiling build/bdist.linux-x86_64/egg/pcapy.py to pcapy.pyc
    installing package data to build/bdist.linux-x86_64/egg
    running install_data
    creating build/bdist.linux-x86_64/egg/share
    creating build/bdist.linux-x86_64/egg/share/doc
    creating build/bdist.linux-x86_64/egg/share/doc/pcapy
    copying README -> build/bdist.linux-x86_64/egg/share/doc/pcapy
    copying LICENSE -> build/bdist.linux-x86_64/egg/share/doc/pcapy
    copying pcapy.html -> build/bdist.linux-x86_64/egg/share/doc/pcapy
    creating build/bdist.linux-x86_64/egg/tests
    copying tests/pcapytests.py -> build/bdist.linux-x86_64/egg/tests
    copying tests/96pings.pcap -> build/bdist.linux-x86_64/egg/tests
    creating build/bdist.linux-x86_64/egg/EGG-INFO
    copying pcapy.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying pcapy.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying pcapy.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    copying pcapy.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
    writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
    zip_safe flag not set; analyzing archive contents...
    creating 'dist/pcapy-0.10.10-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
    removing 'build/bdist.linux-x86_64/egg' (and everything under it)
    Processing pcapy-0.10.10-py2.7-linux-x86_64.egg
    Removing /usr/lib64/python2.7/site-packages/pcapy-0.10.10-py2.7-linux-x86_64.egg
    Copying pcapy-0.10.10-py2.7-linux-x86_64.egg to /usr/lib64/python2.7/site-packages
    pcapy 0.10.10 is already the active version in easy-install.pth
    
    Installed /usr/lib64/python2.7/site-packages/pcapy-0.10.10-py2.7-linux-x86_64.egg
    Processing dependencies for pcapy==0.10.10
    Finished processing dependencies for pcapy==0.10.10
    So, two ways give us two different results. Possibly, something should be fixed for pip here?

  3. #3
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,124
    Blog Entries
    15

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Hi
    The pip command is wanting/using python3? Try pip3 or pip3.4?
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,124
    Blog Entries
    15

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Hi
    See here: https://github.com/CoreSecurity/pcapy/releases
    Added Python 3 Support
    So it should be pip3 not pip...
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  5. #5
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Quote Originally Posted by malcolmlewis View Post
    Hi
    See here: https://github.com/CoreSecurity/pcapy/releases

    So it should be pip3 not pip...
    ok, no problem:

    Code:
    k_mikhail@linux-mk500:~> sudo pip3 install pcapy
    root's password:
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy ... error
        Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yomf5raj/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fvuj2oe0-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_ext
        building 'pcapy' extension
        creating build
        creating build/temp.linux-x86_64-3.4
        gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python3.4m -c pcapdumper.cc -o build/temp.linux-x86_64-3.4/pcapdumper.o
        pcapdumper.cc:10:20: fatal error: Python.h: Нет такого файла или каталога
         #include <Python.h>
                            ^
        compilation terminated.
        error: command 'gcc' failed with exit status 1
        
        ----------------------------------------
    Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yomf5raj/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fvuj2oe0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yomf5raj/pcapy/


    Here is from ALT Linux:
    Code:
    [configurator@server]$ pip show pcapy
    ---
    Name:pcapy
    Version: 0.10.10
    Location: /usr/lib/python2.7/site-packages
    Requires:
    That means, that pcapy 0.10.10 can be also successfully installed by simple pip, not pip3, command.

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,124
    Blog Entries
    15

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Quote Originally Posted by k_mikhail View Post
    ok, no problem:

    Code:
    k_mikhail@linux-mk500:~> sudo pip3 install pcapy
    root's password:
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy ... error
        Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yomf5raj/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fvuj2oe0-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_ext
        building 'pcapy' extension
        creating build
        creating build/temp.linux-x86_64-3.4
        gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python3.4m -c pcapdumper.cc -o build/temp.linux-x86_64-3.4/pcapdumper.o
        pcapdumper.cc:10:20: fatal error: Python.h: Нет такого файла или каталога
         #include <Python.h>
                            ^
        compilation terminated.
        error: command 'gcc' failed with exit status 1
        
        ----------------------------------------
    Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yomf5raj/pcapy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fvuj2oe0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yomf5raj/pcapy/


    Here is from ALT Linux:
    Code:
    [configurator@server]$ pip show pcapy
    ---
    Name:pcapy
    Version: 0.10.10
    Location: /usr/lib/python2.7/site-packages
    Requires:
    That means, that pcapy 0.10.10 can be also successfully installed by simple pip, not pip3, command.
    Hi
    Is python3-devel package installed?
    Code:
     pip3 install pcapy
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy
    Successfully installed pcapy-0.10.10
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  7. #7
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Is python3-devel package installed?
    Code:
     pip3 install pcapy
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy
    Successfully installed pcapy-0.10.10
    Hmmm... after python3-devel package installation, the both pip and pip3 variants are valid. Fantastic!

    Code:
    k_mikhail@linux-mk500:~> sudo zypper in python3-devel
    Загрузка данных репозитария...
    Чтение установленных пакетов...
    Разрешение зависимостей пакетов...
    
    The following NEW package is going to be installed:
      python3-devel
    
    1 new package to install.
    Общий размер загрузки: 133,2 KiB. Уже кэшировано: 0 B. После этой операции будет использовано дополнительно 494,7 KiB.
    продолжить? [y/n/? выводит все параметры] (y): y
    Получение package python3-devel-3.4.1-6.2.x86_64                                                                                                    (1/1), 133,2 KiB (494,7 KiB нераспаковано)
    Получение: python3-devel-3.4.1-6.2.x86_64.rpm ........................................................................................................................................[ГОТОВО]
    Выполняется проверка на конфликты файлов: ............................................................................................................................................[ГОТОВО]
    (1/1) Устанавливается: python3-devel-3.4.1-6.2.x86_64 ................................................................................................................................[ГОТОВО]
    
    k_mikhail@linux-mk500:~> sudo pip3 install pcapy
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy ... done
    Successfully installed pcapy-0.10.10
    
    k_mikhail@linux-mk500:~> sudo pip3 uninstall pcapy
    Uninstalling pcapy-0.10.10:
      /usr/lib64/python3.4/site-packages/pcapy-0.10.10-py3.4.egg-info
      /usr/lib64/python3.4/site-packages/pcapy.cpython-34m.so
      /usr/share/doc/pcapy/LICENSE
      /usr/share/doc/pcapy/README
      /usr/share/doc/pcapy/pcapy.html
      /usr/tests/96pings.pcap
      /usr/tests/pcapytests.py
    Proceed (y/n)? y
      Successfully uninstalled pcapy-0.10.10
    
    k_mikhail@linux-mk500:~> sudo pip install pcapy
    Collecting pcapy
      Using cached pcapy-0.10.10.tgz
    Installing collected packages: pcapy
      Running setup.py install for pcapy ... done
    Successfully installed pcapy-0.10.10
    Thank you very much for your assistance!

  8. #8
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    UPD:

    Code:
    k_mikhail@linux-mk500:~> pip3 show pcapy
    ---
    Metadata-Version: 1.0
    Name: pcapy
    Version: 0.10.10
    Summary: Python pcap extension
    Home-page: https://github.com/CoreSecurity/pcapy
    Author: CORE Security
    Author-email: oss@coresecurity.com
    License: Apache modified
    Location: /usr/lib64/python3.4/site-packages
    Requires: 
    Classifiers:
    
    
    k_mikhail@linux-mk500:~> pip show pcapy
    ---
    Metadata-Version: 1.0
    Name: pcapy
    Version: 0.10.10
    Summary: Python pcap extension
    Home-page: https://github.com/CoreSecurity/pcapy
    Author: CORE Security
    Author-email: oss@coresecurity.com
    License: Apache modified
    Location: /usr/lib64/python3.4/site-packages
    Requires: 
    Classifiers:
    So, even pip, which is acceptable for python2.7, installs for 3.4? Why? It's bug, as for me....

  9. #9
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,124
    Blog Entries
    15

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Hi
    Look at pip (it's pip3 in disguise) I would guess only python3-pip is installed, not python-pip?
    Code:
    which pip
    /usr/bin/pip
    
    ls -la /usr/bin/pip
    lrwxrwxrwx 1 root root 21 Oct 29  2015 /usr/bin/pip -> /etc/alternatives/pip
    
    cat /etc/alternatives/pip
    #!/usr/bin/python3
    # EASY-INSTALL-ENTRY-SCRIPT: 'pip==7.1.2','console_scripts','pip3.4'
    __requires__ = 'pip==7.1.2'
    import sys
    from pkg_resources import load_entry_point
    
    if __name__ == '__main__':
        sys.exit(
            load_entry_point('pip==7.1.2', 'console_scripts', 'pip3.4')()
        )
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  10. #10
    Join Date
    Nov 2014
    Location
    Kiev, Ukraine
    Posts
    68

    Default Re: 'pcapdumper.cc:10:20: fatal error: Python.h: No such file or directory' via pip install

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Look at pip (it's pip3 in disguise) I would guess only python3-pip is installed, not python-pip?
    Code:
    which pip
    /usr/bin/pip
    
    ls -la /usr/bin/pip
    lrwxrwxrwx 1 root root 21 Oct 29  2015 /usr/bin/pip -> /etc/alternatives/pip
    
    cat /etc/alternatives/pip
    #!/usr/bin/python3
    # EASY-INSTALL-ENTRY-SCRIPT: 'pip==7.1.2','console_scripts','pip3.4'
    __requires__ = 'pip==7.1.2'
    import sys
    from pkg_resources import load_entry_point
    
    if __name__ == '__main__':
        sys.exit(
            load_entry_point('pip==7.1.2', 'console_scripts', 'pip3.4')()
        )
    Seems different distros get different methods here... But ok, the main goal here was to force pcapy to be installed. Thanks again!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •