skip to Main Content

I’m trying to install fasttext using pip install fasttext in python 3.11.4 but I’m running into trouble when building wheels. The error reads as follows:

      error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\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

I’ve searched the web and most hits indicated that the error has something to do with the build tools of visual studio (which the error above also indicated). I’ve installed/updated all my build tools and I’ve also installed the latest SDK as suggested here, but the error persists.

Has anyone solved this problem before and can share any potential solution?

2

Answers


  1. Chosen as BEST ANSWER

    Using pip install fasttext-wheel instead solved the problem for me.


  2. Some have reported managing to compile Facebook’s fasttext package on Windows, and perhaps the issues mentioned in @phd’s comment will have some tips that work for you.

    But note that the project’s official homepage at https://github.com/facebookresearch/fastText only says "Generally, fastText builds on modern Mac OS and Linux distributions" – with no mention of official Windows support.

    So, other than using a workaround, some options could include:

    • switching OSes (which may help with other packages that may be better-supported off of Windows)
    • using an alternative FastText implementation, such as that in the gensim package – which matches the core fasttext word-modeling (& even has some additional options) but misses some things in Facebook’s implementation (mainly the supervised mode & word n-grams).
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search