Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Cannot install FastText on Windows using pip #1343

Open
jzr-supove opened this issue Jul 4, 2023 · 6 comments
Open

Cannot install FastText on Windows using pip #1343

jzr-supove opened this issue Jul 4, 2023 · 6 comments

Comments

@jzr-supove
Copy link

jzr-supove commented Jul 4, 2023

OS: Windows
Python version: 3.10.4
Pip version: 22.0.4
Command: pip install fasttext

Output:

Building wheels for collected packages: fasttext
  Building wheel for fasttext (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      D:\...\venv\lib\site-packages\setuptools\dist.py:757: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\fasttext
      copying python\fasttext_module\fasttext\FastText.py -> build\lib.win-amd64-cpython-310\fasttext
      copying python\fasttext_module\fasttext\__init__.py -> build\lib.win-amd64-cpython-310\fasttext
      creating build\lib.win-amd64-cpython-310\fasttext\util
      copying python\fasttext_module\fasttext\util\util.py -> build\lib.win-amd64-cpython-310\fasttext\util
      copying python\fasttext_module\fasttext\util\__init__.py -> build\lib.win-amd64-cpython-310\fasttext\util
      creating build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\test_configurations.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\test_script.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\__init__.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      running build_ext
      building 'fasttext_pybind' extension
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      creating build\temp.win-amd64-cpython-310\Release\python
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module\fasttext
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module\fasttext\pybind
      creating build\temp.win-amd64-cpython-310\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\...\venv\lib\site-packages\pybind11\include -ID:\...\venv\lib\site-packages\pybind11\includ
e -Isrc -ID:\...\venv\include "-IC:\Users\...\AppData\Local\Programs\Python\Python310\include" "-IC:\Users\...\AppData\Local\Programs\Python\Python310\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include"
 "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Wind
ows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tppython/fasttext_module/fasttext/pybind/fasttext_pybind.cc /Fobuild\temp.win-amd64-cpython-310\Release\python/fasttext_module/fasttext/pybind/fasttext_pybind.obj /EHsc /DVERSION_INFO=\\\"0.9.2\\\"
      fasttext_pybind.cc
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::init': no matching overloaded function found
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(170): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(170): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1916): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(170): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1904): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::class_<fasttext::Vector>::def': no matching overloaded function found
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(170): error C2780: 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1567): note: see declaration of 'pybind11::class_<fasttext::Vector>::def'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::init': no matching overloaded function found
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(182): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(182): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1916): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(182): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1904): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::class_<fasttext::DenseMatrix>::def': no matching overloaded function found
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(182): error C2780: 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
      D:\...\venv\lib\site-packages\pybind11\include\pybind11\pybind11.h(1567): note: see declaration of 'pybind11::class_<fasttext::DenseMatrix>::def'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fasttext
  Running setup.py clean for fasttext
Failed to build fasttext
ERROR: Could not build wheels for fasttext, which is required to install pyproject.toml-based projects
@SDAravind
Copy link

Provide more details to reproduce the error

  • Python version
  • Package manger
  • Command that you ran

@GBurg
Copy link

GBurg commented Jul 20, 2023

I have the same issue:

Python 3.10
pip
command: pip install fasttext

>pip install fasttext
Collecting fasttext
  Using cached fasttext-0.9.2.tar.gz (68 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.2 in c:\users\geert\miniconda3\envs\whisperspacy\lib\site-packages (from fasttext) (2.11.1)
Requirement already satisfied: setuptools>=0.7.0 in c:\users\geert\miniconda3\envs\whisperspacy\lib\site-packages (from fasttext) (68.0.0)
Requirement already satisfied: numpy in c:\users\geert\miniconda3\envs\whisperspacy\lib\site-packages (from fasttext) (1.24.4)
Building wheels for collected packages: fasttext
  Building wheel for fasttext (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [75 lines of output]
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\setuptools\dist.py:745: SetuptoolsDeprecationWarning: Invalid dash-separated options
      !!
     
              ********************************************************************************
              Usage of dash-separated 'description-file' will not be supported in future
              versions. Please use the underscore name 'description_file' instead.
     
              By 2023-Sep-26, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
     
              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************
     
      !!
        opt = self.warn_dash_deprecation(opt, section)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\fasttext
      copying python\fasttext_module\fasttext\FastText.py -> build\lib.win-amd64-cpython-310\fasttext
      copying python\fasttext_module\fasttext\__init__.py -> build\lib.win-amd64-cpython-310\fasttext
      creating build\lib.win-amd64-cpython-310\fasttext\util
      copying python\fasttext_module\fasttext\util\util.py -> build\lib.win-amd64-cpython-310\fasttext\util
      copying python\fasttext_module\fasttext\util\__init__.py -> build\lib.win-amd64-cpython-310\fasttext\util
      creating build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\test_configurations.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\test_script.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      copying python\fasttext_module\fasttext\tests\__init__.py -> build\lib.win-amd64-cpython-310\fasttext\tests
      running build_ext
      building 'fasttext_pybind' extension
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      creating build\temp.win-amd64-cpython-310\Release\python
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module\fasttext
      creating build\temp.win-amd64-cpython-310\Release\python\fasttext_module\fasttext\pybind
      creating build\temp.win-amd64-cpython-310\Release\src
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include -IC:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include -Isrc -IC:\Users\geert\miniconda3\envs\whisperspacy\include -IC:\Users\geert\miniconda3\envs\whisperspacy\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /EHsc /Tppython/fasttext_module/fasttext/pybind/fasttext_pybind.cc /Fobuild\temp.win-amd64-cpython-310\Release\python/fasttext_module/fasttext/pybind/fasttext_pybind.obj /EHsc /DVERSION_INFO=\\\"0.9.2\\\"     
      fasttext_pybind.cc
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::init': no matching overloaded function found
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1932): note: could be 'Ret pybind11::init(CFunc &&,AFunc &&)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: or       'Ret pybind11::init(Func &&)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: or       'pybind11::detail::initimpl::constructor<Args...> pybind11::init(void)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'Args', type expected
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::class_<fasttext::Vector>::def': no matching overloaded function found
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1631): note: could be 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1625): note: or       'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1618): note: or       'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1611): note: or       'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1599): note: or       'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const T &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1574): note: or       'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const char *,Func &&,const Extra &...)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::init': no matching overloaded function found
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1932): note: could be 'Ret pybind11::init(CFunc &&,AFunc &&)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: or       'Ret pybind11::init(Func &&)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: or       'pybind11::detail::initimpl::constructor<Args...> pybind11::init(void)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'Args', type expected
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::class_<fasttext::DenseMatrix>::def': no matching overloaded function found
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1631): note: could be 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1625): note: or       'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1618): note: or       'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1611): note: or       'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1599): note: or       'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const T &,const Extra &...)'
      C:\Users\geert\miniconda3\envs\whisperspacy\lib\site-packages\pybind11\include\pybind11\pybind11.h(1574): note: or       'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const char *,Func &&,const Extra &...)'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fasttext
  Running setup.py clean for fasttext
Failed to build fasttext
ERROR: Could not build wheels for fasttext, which is required to install pyproject.toml-based projects

@ism
Copy link

ism commented Jul 22, 2023

  1. git clone https://github.com/facebookresearch/fastText/
  2. manually add this code: https://github.com/facebookresearch/fastText/pull/1279/files
  3. python setup.py install

@SDAravind
Copy link

Alteratively, you can try fasttext-wheel and see if it works for windows

pip install fasttext-wheel

@sushil211289
Copy link

pip install fasttext-wheel

this will work, Thanks SDAravind

@sgt390
Copy link

sgt390 commented Oct 2, 2023

changing "fasttext" with "fasttext-wheel" in setup.py fixed the problem for me (manually installing fasttext-wheel was not enough)

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

No branches or pull requests

6 participants