pytries / datrie

Fast, efficiently stored Trie for Python. Uses libdatrie.
http://pypi.python.org/pypi/datrie/
GNU Lesser General Public License v2.1
530 stars 88 forks source link

Could not build wheels for datrie -- using MacOS Monterey (12.6) #97

Open bagotaj opened 1 year ago

bagotaj commented 1 year ago

Hey guys, pip install datrie failed because src/datrie.c:26:10: fatal error: 'Python.h' file not found

the full output:

running bdist_wheel
      running build
      running build_clib
      building 'datrie' library
      libdatrie/datrie/alpha-map.c:500:21: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'AlphaChar' (aka 'unsigned int') [-Wsign-compare]
          if (alpha_begin <= ac && ac <= alpha_map->alpha_end)
              ~~~~~~~~~~~ ^  ~~
      1 warning generated.
      libdatrie/datrie/alpha-map.c:500:21: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'AlphaChar' (aka 'unsigned int') [-Wsign-compare]
          if (alpha_begin <= ac && ac <= alpha_map->alpha_end)
              ~~~~~~~~~~~ ^  ~~
      1 warning generated.
      libdatrie/datrie/darray.c:239:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (d->num_cells > SIZE_MAX / sizeof (DACell))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/darray.c:239:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (d->num_cells > SIZE_MAX / sizeof (DACell))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/fileutils.c:103:52: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fread (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      libdatrie/datrie/fileutils.c:109:53: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fwrite (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      2 warnings generated.
      libdatrie/datrie/fileutils.c:103:52: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fread (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      libdatrie/datrie/fileutils.c:109:53: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fwrite (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      2 warnings generated.
      libdatrie/datrie/tail.c:144:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (t->num_tails > SIZE_MAX / sizeof (TailBlock))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/tail.c:144:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (t->num_tails > SIZE_MAX / sizeof (TailBlock))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: build/temp.macosx-10.9-universal2-cpython-39/libdatrie.a will be fat and ar(1) will not be able to operate on it
      running build_ext
      building 'datrie' extension
      src/datrie.c:26:10: fatal error: 'Python.h' file not found
      #include "Python.h"
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' 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 datrie
Failed to build datrie
ERROR: Could not build wheels for datrie, which is required to install pyproject.toml-based projects
(rhymedict-multisite) jbagota@Bagotas-MBP rhymedict-multisite % pip install datrie
Collecting datrie
  Using cached datrie-0.8.2.tar.gz (63 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: datrie
  Building wheel for datrie (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for datrie (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      running bdist_wheel
      running build
      running build_clib
      building 'datrie' library
      libdatrie/datrie/alpha-map.c:500:21: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'AlphaChar' (aka 'unsigned int') [-Wsign-compare]
          if (alpha_begin <= ac && ac <= alpha_map->alpha_end)
              ~~~~~~~~~~~ ^  ~~
      1 warning generated.
      libdatrie/datrie/alpha-map.c:500:21: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'AlphaChar' (aka 'unsigned int') [-Wsign-compare]
          if (alpha_begin <= ac && ac <= alpha_map->alpha_end)
              ~~~~~~~~~~~ ^  ~~
      1 warning generated.
      libdatrie/datrie/darray.c:239:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (d->num_cells > SIZE_MAX / sizeof (DACell))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/darray.c:239:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (d->num_cells > SIZE_MAX / sizeof (DACell))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/fileutils.c:103:52: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fread (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      libdatrie/datrie/fileutils.c:109:53: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fwrite (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      2 warnings generated.
      libdatrie/datrie/fileutils.c:103:52: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fread (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      libdatrie/datrie/fileutils.c:109:53: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
          return (fwrite (buff, sizeof (char), len, file) == len);
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
      2 warnings generated.
      libdatrie/datrie/tail.c:144:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (t->num_tails > SIZE_MAX / sizeof (TailBlock))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      libdatrie/datrie/tail.c:144:22: warning: comparison of integers of different signs: 'TrieIndex' (aka 'int') and 'unsigned long' [-Wsign-compare]
          if (t->num_tails > SIZE_MAX / sizeof (TailBlock))
              ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: build/temp.macosx-10.9-universal2-cpython-39/libdatrie.a will be fat and ar(1) will not be able to operate on it
      running build_ext
      building 'datrie' extension
      src/datrie.c:26:10: fatal error: 'Python.h' file not found
      #include "Python.h"
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' 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 datrie
Failed to build datrie
ERROR: Could not build wheels for datrie, which is required to install pyproject.toml-based projects
svenvanderburg commented 1 year ago

I report the same issue. In fact, multiple students in my classroom with different operating systems (mac os, windows, windows) have it.

bricoletc commented 1 year ago

I had the same issue on my Ubuntu machine - clang is trying to pull in "Python.h", a header file used to build python extensions. In my case I ran apt install python3-dev to obtain the header and it all worked. More info here :-)

LaniakeaS commented 4 months ago

any updates?

janluke commented 3 months ago

Same issue on Ubuntu with Python 3.10. With Python 3.8 it worked.

janluke commented 3 months ago

It's simply due to the fact the author doesn't build and push wheels for python > 3.8: https://pypi.org/project/datrie/#files

Tianqi-Ma commented 2 months ago

It's simply due to the fact the author doesn't build and push wheels for python > 3.8: https://pypi.org/project/datrie/#files

Are there any solutions for 3.10?

Tianqi-Ma commented 2 months ago

It's simply due to the fact the author doesn't build and push wheels for python > 3.8: https://pypi.org/project/datrie/#files

Are there any solutions for 3.10?

I found a solution: just download whl file and change its name to the version of your python. For example, I download "datrie-0.8.2-pp373-pypy36_pp73-win32.whl" and change it to "datrie-0.8.2-cp310-none-any.whl". Then running " pip install ......\Downloads\datrie-0.8.2-cp310-none-any.whl".

chuan-mt commented 2 months ago

pip install -r dev-requirements.txt pip install datrie install dev-requirements.txt depends can solve this problem https://github.com/pytries/datrie/blob/master/dev-requirements.txt

cython hypothesis pytest