python-3.x 为收集的包构建轮子:快速文本不工作

svgewumm  于 2023-03-13  发布在  Python
关注(0)|答案(1)|浏览(135)

当我做pip install fasttext的时候,它首先告诉我我需要c++构建工具,我去下载了它们,现在我得到了这个我无法解决的错误。
我已经更新了pip并且使用了python 3.10.4

C:\Users\SumYin>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\sumyin\appdata\local\programs\python\python310\lib\site-packages (from fasttext) (2.9.2)
Requirement already satisfied: setuptools>=0.7.0 in c:\users\sumyin\appdata\local\programs\python\python310\lib\site-packages (from fasttext) (62.3.2)
Requirement already satisfied: numpy in c:\users\sumyin\appdata\local\programs\python\python310\lib\site-packages (from fasttext) (1.22.3)
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]
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py:772: 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\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include -Isrc -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\include -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\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)\Windows 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(171): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1920): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1900): 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
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1577): 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(185): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1920): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1900): 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
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1577): note: see declaration of 'pybind11::class_<fasttext::DenseMatrix>::def'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\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
Installing collected packages: fasttext
  Running setup.py install for fasttext ... error
  error: subprocess-exited-with-error

  × Running setup.py install for fasttext did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py:772: 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 install
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      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\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include -Isrc -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\include -IC:\Users\SumYin\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\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)\Windows 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(171): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1920): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1900): 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
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1577): 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(185): error C2974: 'pybind11::init': invalid template argument for 'CFunc', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1920): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2974: 'pybind11::init': invalid template argument for 'Func', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: see declaration of 'pybind11::init'
      python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2974: 'pybind11::init': invalid template argument for 'Args', type expected
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1900): 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
      C:\Users\SumYin\AppData\Local\Programs\Python\Python310\lib\site-packages\pybind11\include\pybind11\pybind11.h(1577): note: see declaration of 'pybind11::class_<fasttext::DenseMatrix>::def'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\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: legacy-install-failure

× Encountered error while trying to install package.
╰─> fasttext

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
7lrncoxx

7lrncoxx1#

如果您查看fasttext package at PyPI的信息,它会显示:
fastText建立在现代的Mac OS和Linux发行版上。由于它使用C11的特性,它需要一个具有良好C11支持的编译器。
值得注意的是,它没有提到Windows --与最常用于开源文本处理/机器学习工作的Linux/MacOS系统相比,Windows在编译复杂性方面往往有额外的缺陷。

相关问题