Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation of snd file via pip3 fails : Building wheel for sndfile (setup.py) ... error fatal error: sndfile.h: No such file or directory #include <sndfile.h> #2

Open
marcoippolito opened this issue Sep 2, 2019 · 9 comments

Comments

@marcoippolito
Copy link

installation of snd file via pip3 fails:

(base) marco@pc:~/Resemblyzer$ 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 /home/marco/anaconda3/lib/python3.7/site-packages 
 (from sndfile) (1.12.3)
Requirement already satisfied: pycparser in /home/marco/anaconda3/lib/python3.7/site-packages  
 (from cffi>=1.0.0->sndfile) (2.19)
Building wheels for collected packages: sndfile
  Building wheel for sndfile (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/marco/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; 
   sys.argv[0] = '"'"'/tmp/pip-install-7w_p8_7r/sndfile/setup.py'"'"'; __file__='"'"'/tmp/pip-install-  
   7w_p8_7r/sndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"',  
   open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, 
   '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-n2k5xwj9 --python-tag cp37
       cwd: /tmp/pip-install-7w_p8_7r/sndfile/
Complete output (23 lines):
  running bdist_wheel
  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/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: Failed building wheel for sndfile
  Running setup.py clean for sndfile
Failed to build sndfile
Installing collected packages: sndfile
  Running setup.py install for sndfile ... error
    ERROR: Command errored out with exit status 1:
     command: /home/marco/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; 
sys.argv[0] = '"'"'/tmp/pip-install-7w_p8_7r/sndfile/setup.py'"'"'; __file__='"'"'/tmp/pip-install- 
7w_p8_7r/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-67675cxl/install-record.txt --single-version-externally-
managed --compile
         cwd: /tmp/pip-install-7w_p8_7r/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/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/anaconda3/bin/python -u -c 
'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7w_p8_7r/sndfile/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-7w_p8_7r/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-67675cxl/install-record.txt --single-version-externally-
managed --compile 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)

Looking forward to your kind help.
Marco

@marcoippolito marcoippolito changed the title installation of snd file via pip3 fails : Building wheel for sndfile (setup.py) ... error installation of snd file via pip3 fails : Building wheel for sndfile (setup.py) ... error fatal error: sndfile.h: No such file or directory #include <sndfile.h> Sep 2, 2019
@haobibo
Copy link

haobibo commented Sep 16, 2019

@marcoippolito try this: sudo apt-get install libsndfile1-dev

@harrygcoppock
Copy link

I am working on a virtual machine that I do not have access to, is there an alternative solution?

@M5era
Copy link

M5era commented Nov 3, 2021

Did anyone find a solution to this? Same problem

@harrygcoppock
Copy link

Hi @M5era for me updating gcc and gxx worked:
conda install gcc_linux-64 gxx_linux-64 compilers c-compiler cxx-compiler

@M5era
Copy link

M5era commented Nov 8, 2021

Thanks for the tip! However it is still not working. This is my output:

Running setup.py install for sndfile: started Running setup.py install for sndfile: finished with status 'error' ERROR: Command errored out with exit status 1: command: /opt/hostedtoolcache/Python/3.9.7/x64/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d54b_6vg/sndfile_0f2509c97b454b36a6ba7d8353dbb63e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d54b_6vg/sndfile_0f2509c97b454b36a6ba7d8353dbb63e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ntmvwqog/install-record.txt --single-version-externally-managed --compile --install-headers /opt/hostedtoolcache/Python/3.9.7/x64/include/python3.9/sndfile cwd: /tmp/pip-install-d54b_6vg/sndfile_0f2509c97b454b36a6ba7d8353dbb63e/ Complete output (23 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.9 creating build/lib.linux-x86_64-3.9/sndfile copying sndfile/__init__.py -> build/lib.linux-x86_64-3.9/sndfile copying sndfile/vio.py -> build/lib.linux-x86_64-3.9/sndfile copying sndfile/formats.py -> build/lib.linux-x86_64-3.9/sndfile copying sndfile/io.py -> build/lib.linux-x86_64-3.9/sndfile copying sndfile/build.py -> build/lib.linux-x86_64-3.9/sndfile running build_ext generating cffi module 'build/temp.linux-x86_64-3.9/sndfile._sndfile.c' creating build/temp.linux-x86_64-3.9 building 'sndfile._sndfile' extension creating build/temp.linux-x86_64-3.9/build creating build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/opt/hostedtoolcache/Python/3.9.7/x64/include/python3.9 -c build/temp.linux-x86_64-3.9/sndfile._sndfile.c -o build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9/sndfile._sndfile.o build/temp.linux-x86_64-3.9/sndfile._sndfile.c:571:10: fatal error: sndfile.h: No such file or directory 571 | #include <sndfile.h> | ^~~~~~~~~~~ compilation terminated. error: command '/usr/bin/gcc' failed with exit code 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/hostedtoolcache/Python/3.9.7/x64/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d54b_6vg/sndfile_0f2509c97b454b36a6ba7d8353dbb63e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d54b_6vg/sndfile_0f2509c97b454b36a6ba7d8353dbb63e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ntmvwqog/install-record.txt --single-version-externally-managed --compile --install-headers /opt/hostedtoolcache/Python/3.9.7/x64/include/python3.9/sndfile Check the logs for full command output. Error: Process completed with exit code 1.

And I am already installing these in the dockerfile:

RUN apt-get -y install python3.9-dev RUN apt-get -y install libsndfile1-dev RUN apt-get -y install gcc g++ gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9 #RUN brew install gcc RUN apt-get -y install build-essential RUN apt-get -y install manpages-dev RUN pip3 install --user wheel RUN apt-get -y install libxml2-dev libxslt-dev python-dev

and these in the requirements.txt:

asgiref==3.4.1 boto3==1.18.48 botocore==1.21.48 certifi==2021.5.30 charset-normalizer==2.0.6 click==8.0.1 fastapi==0.68.1 filelock==3.1.0 h11==0.12.0 huggingface-hub==0.0.17 idna==3.2 jellyfish==0.8.8 jmespath==0.10.0 joblib==1.0.1 networkx==2.6.3 nltk==3.6.3 numpy==1.21.2 packaging==21.0 Pillow==8.3.2 pydantic==1.8.2 pyparsing==2.4.7 python-dateutil==2.8.2 PyYAML==5.4.1 regex==2021.9.24 requests==2.26.0 s3transfer==0.5.0 sacremoses==0.0.46 scikit-learn==1.0 scipy==1.7.1 segtok==1.5.10 stop_words sentence-transformers==2.0.0 sentencepiece==0.1.96 six==1.16.0 sklearn==0.0 starlette==0.14.2 tabulate==0.8.9 threadpoolctl==2.2.0 tokenizers==0.10.3 torch==1.9.1 torchvision==0.10.1 tqdm==4.62.3 transformers==4.10.3 typing-extensions==3.10.0.2 urllib3==1.26.7 uvicorn==0.15.0 yake==0.4.8 gcc7 sndfile noisereduce==2.0.0 git+https://github.com/csteinmetz1/pymixconsole SoundFile==0.10.3.post1

@harrygcoppock
Copy link

Hmmm then sorry I am not sure what can help. - my issue was related however I was building another package from source which required sndfile. So not exactly the same issue.

@M5era
Copy link

M5era commented Nov 8, 2021

I located the problem further to the noisereduce library which is using sndfile. Somehow this is causing problems. Still working on a solution though. Thanks for your answer!

@harrygcoppock
Copy link

Sorry I couldn't help

@carloselcastro
Copy link

sudo apt-get install libsndfile1 libsndfile1-dev

worked for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants