resemble-ai / Resemblyzer

A python package to analyze and compare voices with deep learning
Apache License 2.0
2.75k stars 425 forks source link

sndfile library not found. But when install sndfile with pip3: sndfile._sndfile.c:494:10: fatal error: sndfile.h: No such file or directory #5

Closed marcoippolito closed 5 years ago

marcoippolito commented 5 years ago
(resemblyzerTest) (base) marco@pc:~/resemblyzerTest$ pip3 install resemblyzer
Collecting resemblyzer
  Using cached https://files.pythonhosted.org/packages/e0/21 
   /f0a22ee4afd9e5d9790b04329accdb71d2cf89ffaf5bb0611fb37cd91782/Resemblyzer-0.1.1.dev0-
   py3-none-any.whl
Collecting typing (from resemblyzer)
  Using cached https://files.pythonhosted.org/packages/fe/2e
   /b480ee1b75e6d17d2993738670e75c1feeb9ff7f64452153cf018051cc92/typing-3.7.4.1-py3-
   none-any.whl
Collecting numpy>=1.10.1 (from resemblyzer)
  Using cached https://files.pythonhosted.org/packages/25/eb
   /4ecf6b13897391cb07a4231e9d9c671b55dfbbf6f4a514a1a0c594f2d8d9/numpy-1.17.1-cp37-
   cp37m-manylinux1_x86_64.whl
Collecting torch>=1.0.1 (from resemblyzer)
 Using cached https://files.pythonhosted.org/packages/05/65
 /5248be50c55ab7429dd5c11f5e2f9f5865606b80e854ca63139ad1a584f2/torch-1.2.0-cp37-
  cp37m-manylinux1_x86_64.whl
Collecting webrtcvad>=2.0.10 (from resemblyzer)
Collecting librosa>=0.6.1 (from resemblyzer)
Collecting scipy>=1.2.1 (from resemblyzer)
  Using cached https://files.pythonhosted.org/packages/94/7f
   /b535ec711cbcc3246abea4385d17e1b325d4c3404dd86f15fc4f3dba1dbb/scipy-1.3.1-cp37-
   cp37m-manylinux1_x86_64.whl
Collecting decorator>=3.0.0 (from librosa>=0.6.1->resemblyzer)
 Using cached https://files.pythonhosted.org/packages/5f/88
 /0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-
 py2.py3-none-any.whl
Collecting resampy>=0.2.0 (from librosa>=0.6.1->resemblyzer)
Collecting joblib>=0.12 (from librosa>=0.6.1->resemblyzer)
   Using cached https://files.pythonhosted.org/packages/cd/c1
    /50a758e8247561e58cb87305b1e90b171b8c767b15b12a1734001f41d356/joblib-0.13.2-
     py2.py3-none-any.whl
Collecting soundfile>=0.9.0 (from librosa>=0.6.1->resemblyzer)
  Using cached https://files.pythonhosted.org/packages/68/64
  /1191352221e2ec90db7492b4bf0c04fd9d2508de67b3f39cbf093cd6bd86/SoundFile-0.10.2-
   py2.py3-none-any.whl
Collecting audioread>=2.0.0 (from librosa>=0.6.1->resemblyzer)
Collecting six>=1.3 (from librosa>=0.6.1->resemblyzer)
 Using cached https://files.pythonhosted.org/packages/73/fb
  /00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-
  any.whl
Collecting scikit-learn!=0.19.0,>=0.14.0 (from librosa>=0.6.1->resemblyzer)
  Using cached https://files.pythonhosted.org/packages/9f/c5
  /e5267eb84994e9a92a2c6a6ee768514f255d036f3c8378acfa694e9f2c99/scikit_learn-0.21.3-
 cp37-cp37m-manylinux1_x86_64.whl
Collecting numba>=0.38.0 (from librosa>=0.6.1->resemblyzer)
  Using cached https://files.pythonhosted.org/packages/b5/9b
  /7ad0a181b66d58334a2233f18fc8345e3ff17ea6f8db0eb59dc31182b6a9/numba-0.45.1-cp37-
  cp37m-manylinux1_x86_64.whl
Collecting cffi>=1.0 (from soundfile>=0.9.0->librosa>=0.6.1->resemblyzer)
  Using cached https://files.pythonhosted.org/packages/a0/ea
    /37fe21475c884f88a2ae496cab10e8f84f0cc11137be860af9eb37a3edb9/cffi-1.12.3-cp37-
    cp37m-manylinux1_x86_64.whl
Collecting llvmlite>=0.29.0dev0 (from numba>=0.38.0->librosa>=0.6.1->resemblyzer)
   Using cached https://files.pythonhosted.org/packages/30/ae/ 
    a33eb9a94734889c189ba4b05170ac0ede05904db5d3dd31158cb33ac16e/llvmlite-0.29.0-1-
    cp37-cp37m-manylinux1_x86_64.whl
Collecting pycparser (from cffi>=1.0->soundfile>=0.9.0->librosa>=0.6.1->resemblyzer)
  Using cached https://files.pythonhosted.org/packages/68/9e
  /49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz
  Installing collected packages: typing, numpy, torch, webrtcvad, decorator, llvmlite, numba, scipy, 
  six, resampy, joblib, pycparser, cffi, soundfile, audioread, scikit-learn, librosa, resemblyzer
  Running setup.py install for pycparser ... done
Successfully installed audioread-2.1.8 cffi-1.12.3 decorator-4.4.0 joblib-0.13.2 librosa-0.7.0 llvmlite-
0.29.0 numba-0.45.1 numpy-1.17.1 pycparser-2.19 resampy-0.2.2 resemblyzer-0.1.1.dev0 scikit-
learn-0.21.3 scipy-1.3.1 six-1.12.0 soundfile-0.10.2 torch-1.2.0 typing-3.7.4.1 webrtcvad-2.0.10
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(resemblyzerTest) (base) marco@pc:~/resemblyzerTest$ pip3 install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db  
/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-
any.whl
Installing collected packages: pip
 Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.2.3

But when trying to install sndfile package :

(resemblyzerTest) (base) marco@pc:~/resemblyzerTest$ pip3 install sndfile
Collecting sndfile
  Using cached https://files.pythonhosted.org/packages/db/ce
/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in ./lib/python3.7/site-packages (from sndfile) (1.12.3)
Requirement already satisfied: pycparser in ./lib/python3.7/site-packages (from 
cffi>=1.0.0->sndfile) (2.19)
Installing collected packages: sndfile
  Running setup.py install for sndfile ... error
    ERROR: Command errored out with exit status 1:
     command: /home/marco/resemblyzerTest/bin/python3 -u -c 'import sys, setuptools, tokenize; 
sys.argv[0] = '"'"'/tmp/pip-install-qcs9_nwv/sndfile/setup.py'"'"'; __file__='"'"'/tmp/pip-install- 
qcs9_nwv/sndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"',  
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, 
'"'"'exec'"'"'))' install --record /tmp/pip-record-2d8yk4e3/install-record.txt --single-version-externally-
managed --compile --install-headers /home/marco/resemblyzerTest/include/site/python3.7/sndfile
         cwd: /tmp/pip-install-qcs9_nwv/sndfile/
    Complete output (23 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/sndfile
    copying sndfile/__init__.py -> build/lib.linux-x86_64-3.7/sndfile
    copying sndfile/vio.py -> build/lib.linux-x86_64-3.7/sndfile
    copying sndfile/build.py -> build/lib.linux-x86_64-3.7/sndfile
    copying sndfile/formats.py -> build/lib.linux-x86_64-3.7/sndfile
    copying sndfile/io.py -> build/lib.linux-x86_64-3.7/sndfile
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.7/sndfile._sndfile.c'
    creating build/temp.linux-x86_64-3.7
    building 'sndfile._sndfile' extension
    creating build/temp.linux-x86_64-3.7/build
    creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
    gcc -pthread -B /home/marco/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare 
-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/marco/resemblyzerTest/include 
-I/home/marco/anaconda3/include/python3.7m -c build/temp.linux-x86_64-3.7/sndfile._sndfile.c -o
build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/sndfile._sndfile.o
    build/temp.linux-x86_64-3.7/sndfile._sndfile.c:494:10: fatal error: sndfile.h: No such file or 
directory
     #include <sndfile.h>
              ^~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/marco/resemblyzerTest/bin/python3 -u -c      
'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qcs9_nwv/sndfile/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-qcs9_nwv/sndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', 
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, 
'"'"'exec'"'"'))' install --record /tmp/pip-record-2d8yk4e3/install-record.txt --single-version-externally-
managed --compile --install-headers /home/marco/resemblyzerTest/include/site/python3.7/sndfile   
Check the logs for full command output.

Operating System: Ubuntu 18.04.02 Server Edition
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
pip3 -V
pip 19.2.3 from /home/marco/anaconda3/lib/python3.7/site-packages/pip (python 3.7)

How to solve the problem? Marco

CorentinJ commented 5 years ago

From https://stackoverflow.com/a/30980601:

On linux it is sufficient to install libsndfile library, for example with sudo apt-get install libsndfile1-dev On OS X just do: brew install libsndfile

marcoippolito commented 5 years ago

Thanks. Solved

Mahdi-Hosseinali commented 2 years ago

Since the M1 chip on Mac (they always find a new way to make life harder), you need to update path as well.

export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib