whotracksme / whotracks.me

Data from the largest and longest measurement of online tracking.
https://www.ghostery.com/whotracksme
MIT License
405 stars 73 forks source link

Possible Bug: Error declaring DataSource #350

Closed EvilWatermelon closed 3 months ago

EvilWatermelon commented 4 months ago

While testing the example from the README I get the following error:

Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whotracksme.data.loader import DataSource
>>> data = DataSource()
data available for months:
├── 
load trackers
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/isumis/.local/lib/python3.11/site-packages/whotracksme/data/loader.py", line 51, in __init__
    data_months=[max(self.data_months)],
                 ^^^^^^^^^^^^^^^^^^^^^
ValueError: max() arg is an empty sequence
>>> 

This seems to be a bug.

EvilWatermelon commented 3 months ago

Same is in the venv but with a different error

(venv) $ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whotracksme.data.loader import DataSource
>>> data = DataSource()
data available for months: ['2017-05', '2017-06', '2017-07', '2017-08', '2017-09', '2017-10', '2017-11', '2017-12', '2018-01', '2018-02', '2018-03', '2018-04']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/isumis/venv/lib/python3.11/site-packages/whotracksme/data/loader.py", line 61, in __init__
    self.trackers = Trackers(
                    ^^^^^^^^^
  File "/home/isumis/venv/lib/python3.11/site-packages/whotracksme/data/loader.py", line 199, in __init__
    for tracker, month in self.df.groupby('tracker').month.min().iteritems():
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/isumis/venv/lib/python3.11/site-packages/pandas/core/generic.py", line 6296, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Series' object has no attribute 'iteritems'
>>> 
EvilWatermelon commented 3 months ago

Running sudo pip3 install -r requirements-dev.txt returns

Building wheels for collected packages: cffi, numpy, pathtools, pyrsistent, retrying, ujson, watchdog, websockets
  Building wheel for cffi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'libffi', required by 'virtual:world', not found
      /usr/lib/python3/dist-packages/setuptools/config/setupcfg.py:515: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/error.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/model.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/api.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/lock.py -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-311/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-311/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/c
      x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.11 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-311/c/_cffi_backend.o
      c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
         15 | #include <ffi.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cffi
  Running setup.py clean for cffi
  Building wheel for numpy (pyproject.toml) ... /

FIX:

If this happens on your Debian 12 machine then ffi.h is missing and this header file can be installed with apt install libffi-dev