0

I am trying to install fasttext using pip in my virtual environment on a Linux machine. Following is the error traceback I get on running pip install fasttext:

Building wheels for collected packages: fasttext
  Building wheel for fasttext (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/tb662/env/myenv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h1ngt9pg/fasttext_1f97f862ed9f4487a7e396366b109830/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h1ngt9pg/fasttext_1f97f862ed9f4487a7e396366b109830/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-coyom_d1
       cwd: /tmp/pip-install-h1ngt9pg/fasttext_1f97f862ed9f4487a7e396366b109830/
  Complete output (39 lines):
  /home/tb662/env/myenv/lib64/python3.6/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    % (opt, underscore_opt)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/fasttext
  copying python/fasttext_module/fasttext/__init__.py -> build/lib.linux-x86_64-3.6/fasttext
  copying python/fasttext_module/fasttext/FastText.py -> build/lib.linux-x86_64-3.6/fasttext
  creating build/lib.linux-x86_64-3.6/fasttext/util
  copying python/fasttext_module/fasttext/util/util.py -> build/lib.linux-x86_64-3.6/fasttext/util
  copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.linux-x86_64-3.6/fasttext/util
  creating build/lib.linux-x86_64-3.6/fasttext/tests
  copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.linux-x86_64-3.6/fasttext/tests
  copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.linux-x86_64-3.6/fasttext/tests
  copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.linux-x86_64-3.6/fasttext/tests
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  creating tmp
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/tb662/env/myenv/include -I/usr/include/python3.6m -c /tmp/tmpyqk2990e.cpp -o tmp/tmpyqk2990e.o -std=c++14
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/tb662/env/myenv/include -I/usr/include/python3.6m -c /tmp/tmpr8x8shpn.cpp -o tmp/tmpr8x8shpn.o -fvisibility=hidden
  building 'fasttext_pybind' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/python
  creating build/temp.linux-x86_64-3.6/python/fasttext_module
  creating build/temp.linux-x86_64-3.6/python/fasttext_module/fasttext
  creating build/temp.linux-x86_64-3.6/python/fasttext_module/fasttext/pybind
  creating build/temp.linux-x86_64-3.6/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include -I/home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include -Isrc -I/home/tb662/env/myenv/include -I/usr/include/python3.6m -c python/fasttext_module/fasttext/pybind/fasttext_pybind.cc -o build/temp.linux-x86_64-3.6/python/fasttext_module/fasttext/pybind/fasttext_pybind.o -DVERSION_INFO="0.9.2" -std=c++14 -fvisibility=hidden
  In file included from /home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include/pybind11/detail/../attr.h:13:0,
                   from /home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include/pybind11/detail/class.h:12,
                   from /home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include/pybind11/pybind11.h:13,
                   from /home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include/pybind11/numpy.h:12,
                   from python/fasttext_module/fasttext/pybind/fasttext_pybind.cc:13:
  /home/tb662/env/myenv/lib64/python3.6/site-packages/pybind11/include/pybind11/detail/../detail/common.h:212:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

Any help would be appreciated. Thanks in advance!

Tarush
  • 1
  • 1
    https://stackoverflow.com/search?q=%5Bpip%5D+fatal+error%3A+Python.h%3A+No+such+file+or+directory – phd Oct 10 '22 at 17:51

0 Answers0