dugsong / pypcap

Automatically exported from code.google.com/p/pypcap
Other
117 stars 45 forks source link

Can't install: AttributeError: 'NoneType' object has no attribute 'rfind' #49

Closed j2ghz closed 7 years ago

j2ghz commented 8 years ago
$ sudo pip install pypcap
Downloading/unpacking pypcap
  Downloading pypcap-1.1.4.tar.gz (41kB): 41kB downloaded
  Running setup.py (path:/tmp/user/0/pip_build_root/pypcap/setup.py) egg_info for package pypcap
    Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
    Found libraries in None
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
        lib_file = os.path.basename(lib_file_path)
      File "/usr/lib/python2.7/posixpath.py", line 121, in basename
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'
    Complete output from command python setup.py egg_info:
    Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h

Found libraries in None

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>

    lib_file = os.path.basename(lib_file_path)

  File "/usr/lib/python2.7/posixpath.py", line 121, in basename

    i = p.rfind('/') + 1

AttributeError: 'NoneType' object has no attribute 'rfind'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
Storing debug log for failure in /home/<redacted>/.pip/pip.log

/home//.pip/pip.log

------------------------------------------------------------
/usr/bin/pip run on Fri Oct 30 20:53:28 2015
Downloading/unpacking pypcap
  Getting page https://pypi.python.org/simple/pypcap/
  URLs to search for versions for pypcap:
  * https://pypi.python.org/simple/pypcap/
  Analyzing links from page https://pypi.python.org/simple/pypcap/
    Skipping https://pypi.python.org/packages/2.7/p/pypcap/pypcap-1.1.4-cp27-none-macosx_10_10_x86_64.whl#md5=ca7a6a3956f332a29666682ad3996001 (from https://pypi.python.org/simple/pypcap/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.1.tar.gz#md5=d32f422feba022dad219edb1e7de0366 (from https://pypi.python.org/simple/pypcap/), version: 1.1.1
    Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.2.tar.gz#md5=c11ecfd60152ee1039cbc59f537d84ce (from https://pypi.python.org/simple/pypcap/), version: 1.1.2
    Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.3.tar.gz#md5=b1c43d8959123c2d4fa8a1531e0d61ca (from https://pypi.python.org/simple/pypcap/), version: 1.1.3
    Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.4.tar.gz#md5=e2ded33e75d94e4635798a2b2f4aaea1 (from https://pypi.python.org/simple/pypcap/), version: 1.1.4
    Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.tar.gz#md5=d42e03b9cc322b1d3f39847752368f0d (from https://pypi.python.org/simple/pypcap/), version: 1.1
  Using version 1.1.4 (newest of versions: 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1)
  Downloading from URL https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.4.tar.gz#md5=e2ded33e75d94e4635798a2b2f4aaea1 (from https://pypi.python.org/simple/pypcap/)
  Running setup.py (path:/tmp/user/0/pip_build_root/pypcap/setup.py) egg_info for package pypcap
    Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
    Found libraries in None
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
        lib_file = os.path.basename(lib_file_path)
      File "/usr/lib/python2.7/posixpath.py", line 121, in basename
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'
    Complete output from command python setup.py egg_info:
    Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h

Found libraries in None

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>

    lib_file = os.path.basename(lib_file_path)

  File "/usr/lib/python2.7/posixpath.py", line 121, in basename

    i = p.rfind('/') + 1

AttributeError: 'NoneType' object has no attribute 'rfind'

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/user/0/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 715, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
phirestalker commented 8 years ago

I have the same problem on OSX 10.11.1

phirestalker commented 8 years ago

I was able to get it to install by replacing d with '/usr' on line 46 of setup.py, like this:

lib_sub_dirs = [os.path.join('/usr', sub_dir) \

I can't guarantee it will work on all systems as it is a quick and dirty hack, but there you go

t2d commented 8 years ago

same problem on Ubuntu 15.04

➜  ~ sudo pip install pypcap
Downloading/unpacking pypcap
  Downloading pypcap-1.1.4.tar.gz (41kB): 41kB downloaded
  Running setup.py (path:/tmp/pip-build-mtsqO_/pypcap/setup.py) egg_info for package pypcap
    Found pcap headers in /usr/src/linux-headers-4.2.0-30-generic/include/config/ezx/pcap.h
    Found libraries in None
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-build-mtsqO_/pypcap/setup.py", line 60, in <module>
        lib_file = os.path.basename(lib_file_path)
      File "/usr/lib/python2.7/posixpath.py", line 114, in basename
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'
    Complete output from command python setup.py egg_info:
    Found pcap headers in /usr/src/linux-headers-4.2.0-30-generic/include/config/ezx/pcap.h

Found libraries in None

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip-build-mtsqO_/pypcap/setup.py", line 60, in <module>

    lib_file = os.path.basename(lib_file_path)

  File "/usr/lib/python2.7/posixpath.py", line 114, in basename

    i = p.rfind('/') + 1

AttributeError: 'NoneType' object has no attribute 'rfind'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-mtsqO_/pypcap
lconceicao commented 8 years ago

same problem in ubuntu 16.04:

pip install pypcap
Collecting pypcap
  Using cached pypcap-1.1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Found pcap headers in /usr/src/linux-headers-4.4.0-28-generic/include/config/touchscreen/pcap.h
    Found libraries in None
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-YMm_2h/pypcap/setup.py", line 59, in <module>
        lib_file = os.path.basename(lib_file_path)
      File "/home/lconceicao/envs/pypcap-test/lib/python2.7/posixpath.py", line 114, in basename
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-YMm_2h/pypcap/
syjcnss commented 8 years ago

Pip is using the wrong pcap header. Install libpcap-dev will fix this issue in ubuntu.

hellais commented 7 years ago

Note the current development of pypcap is now on: https://github.com/pynetwork/pypcap.

Please file issues there.