1

answer found

https://github.com/pysam-developers/pysam/issues/828


You gotta put these in your terminal
export LDFLAGS=-L/usr/local/opt/xz/lib
export CPPFLAGS="-I/usr/local/opt/xz/include"

Original Question

I was trying to pip3 install kenlm or pip3 install pypi-kenlm. But either way prompt me that the installation could not complete because command ‘/usr/bin/clang’ failed with exit code 1, where #include <lzma.h> is complaining that fatal error: 'lzma.h' hile not found (exact code attached). May someone please help me dig into this problem? Thank you!!

This question has not been asked before, my machine is a mac (not linux), I have got all the necessary package installed, see below

machine: MacBook pro 15, mid-2019 intel
python ver: python 3.9.13
clang ver: 13.1.6
pip version 22.1.2
setuptools-62.3.3
wheel-0.37.1
xz: 5.2.5

exact problem

(venv) ➜  project git:(chalres/dev) ✗ pip3 install pypi-kenlm
Collecting pypi-kenlm
  Using cached pypi-kenlm-0.1.20210121.tar.gz (253 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pypi-kenlm
  Building wheel for pypi-kenlm (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [68 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'kenlm' extension
      creating build
      creating build/temp.macosx-12-x86_64-cpython-39
      creating build/temp.macosx-12-x86_64-cpython-39/lm
      creating build/temp.macosx-12-x86_64-cpython-39/python
      creating build/temp.macosx-12-x86_64-cpython-39/util
      creating build/temp.macosx-12-x86_64-cpython-39/util/double-conversion
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I. "-I/Users/charles/Library/Mobile Documents/com~apple~CloudDocs/cree_proj/creePredictiveTextUI/venv/include" -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lm/bhiksha.cc -o build/temp.macosx-12-x86_64-cpython-39/lm/bhiksha.o -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -DHAVE_ZLIB -DHAVE_BZLIB -DHAVE_XZLIB
(((other clang log)))
     clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I. "-I/Users/hongweiwang/Library/Mobile Documents/com~apple~CloudDocs/cree_proj/creePredictiveTextUI/venv/include" -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c lm/vocab.cc -o build/temp.macosx-12-x86_64-cpython-39/lm/vocab.o -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -DHAVE_ZLIB -DHAVE_BZLIB -DHAVE_XZLIB
      In file included from lm/vocab.cc:11:
      ./util/joint_sort.hh:60:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
          typedef struct {
                        ^
                         value_type
      ./util/joint_sort.hh:63:7: note: type is not C-compatible due to this member declaration
            const typename std::iterator_traits<KeyIter>::value_type &GetKey() const { return key; }
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./util/joint_sort.hh:64:7: note: type is given name 'value_type' for linkage purposes by this typedef declaration
          } value_type;
            ^
      1 warning generated.
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I. "-I/Users/hongweiwang/Library/Mobile Documents/com~apple~CloudDocs/cree_proj/creePredictiveTextUI/venv/include" -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c python/kenlm.cpp -o build/temp.macosx-12-x86_64-cpython-39/python/kenlm.o -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -DHAVE_ZLIB -DHAVE_BZLIB -DHAVE_XZLIB
(((other clang log)))
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I. "-I/Users/charles/Library/Mobile Documents/com~apple~CloudDocs/cree_proj/creePredictiveTextUI/venv/include" -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c util/read_compressed.cc -o build/temp.macosx-12-x86_64-cpython-39/util/read_compressed.o -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -DHAVE_ZLIB -DHAVE_BZLIB -DHAVE_XZLIB
      util/read_compressed.cc:24:10: fatal error: 'lzma.h' file not found
      #include <lzma.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 pypi-kenlm
  Running setup.py clean for pypi-kenlm
Failed to build pypi-kenlm
Installing collected packages: pypi-kenlm
  Running setup.py install for pypi-kenlm ... error
  error: subprocess-exited-with-error
Hongwei-W
  • 31
  • 3

0 Answers0