Search code examples
pip

how to download sent2vec library


So I'm trying to download sent2vec (this one: https://github.com/epfml/sent2vec) on windows, and I have issues with that.

to my understanding, pip installs won't work because it will get a different package with the same name. I tried to download the library by manually git cloning the sent2vec and fastText libraries and then using pip install . (I got the idea from another thread).

When trying to pip install sent2vec, I get this error:

  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.17.1 in c:\python38\lib\site-packages (from sent2vec==0.0.0) (1.24.0)
Requirement already satisfied: Cython>=0.29.13 in c:\python38\lib\site-packages (from sent2vec==0.0.0) (0.29.32)
Building wheels for collected packages: sent2vec
  Building wheel for sent2vec (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for sent2vec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x86\\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 sent2vec
Failed to build sent2vec
ERROR: Could not build wheels for sent2vec, which is required to install pyproject.toml-based projects

Solution

  • sent2vec requires Facebook's FastText library which builds on Unix (Linux distributions and modern Mac OS). The list of compiler flags is clearly for GCC, they don't work with MSVC.

    The bottom line is: the library cannot be built on w64.

    sent2vec repository includes a Dockerfile so you can try to use Docker. Or you can try WSL2. Both the Dockerfile and WSL2 run Ubuntu, a Linux distribution.

    Upd. The Dockerfile was not updated in 3 years, last commit was on Aug 29, 2019, so it's a bit outdated. The simplest fix currently seems to be editing it after cloning and setting a version in the 1st line: make it FROM ubuntu:18.04