[Python] Can't install spaCy (and thinc) on Python

Discussão em 'Python' iniciado por Stack, Março 31, 2025.

  1. Stack

    Stack Membro Participativo

    When I try to install spaCy to use with chatterBot (somehow it didn't download with ChatterBot), first I got an error because I did not have the Cython module installed into my virtual environment, and then I got stuck into this:

    pip install spacy
    Collecting spacy
    Using cached spacy-3.7.5-cp38-cp38-win_amd64.whl.metadata (27 kB)
    Collecting spacy-legacy<3.1.0,>=3.0.11 (from spacy)
    Using cached spacy_legacy-3.0.12-py2.py3-none-any.whl.metadata (2.8 kB)
    ...

    Building wheels for collected packages: thinc
    Building wheel for thinc (pyproject.toml) ... error
    error: subprocess-exited-with-error

    × Building wheel for thinc (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [448 lines of output]
    Cythonizing sources
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-cpython-38
    creating build\lib.win-amd64-cpython-38\thinc
    ... copying and creating stuff ...
    dependency C:\Users\scrht\AppData\Local\Programs\Python\Python38\Include\Python.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\arrayobject.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\arrayscalars.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ndarrayobject.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ndarraytypes.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ufuncobject.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Programs\Python\Python38\Include\Python.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\arrayobject.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\arrayscalars.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ndarrayobject.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ndarraytypes.h won't be automatically included in the manifest: the path must be relative
    dependency C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\numpy\core\include\numpy\ufuncobject.h won't be automatically included in the manifest: the path must be relative
    reading manifest file 'thinc.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: manifest_maker: MANIFEST.in, line 4: path 'tmp/' cannot end with '/'

    warning: no previously-included files matching '*.cpp' found under directory 'thinc'
    adding license file 'LICENSE'
    writing manifest file 'thinc.egg-info\SOURCES.txt'
    C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\setuptools\command\build_py.py:215: _Warning: Package 'thinc.backends' is absent from the `packages` configuration.
    !!

    ********************************************************************************
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'thinc.backends' as an importable package[^1],
    but it is absent from setuptools' `packages` configuration.

    This leads to an ambiguous overall configuration. If you want to distribute this
    package, please make sure that 'thinc.backends' is explicitly added
    to the `packages` configuration field.

    Alternatively, you can also rely on setuptools' discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

    If you don't want 'thinc.backends' to be distributed and are
    already explicitly excluding 'thinc.backends' via
    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
    you can try to use `exclude_package_data`, or `include-package-data=False` in
    combination with a more fine grained `package-data` configuration.

    You can read more about "package data files" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


    [^1]: For Python, any directory (with suitable naming) can be imported,
    even if it does not contain any `.py` files.
    On the other hand, currently there is no concept of package data
    directory, all directories are treated like packages.
    ********************************************************************************

    !!
    check.warn(importable)
    C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\setuptools\command\build_py.py:215: _Warning: Package 'thinc.extra' is absent from the `packages` configuration.
    !!

    ********************************************************************************
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'thinc.extra' as an importable package[^1],
    but it is absent from setuptools' `packages` configuration.

    This leads to an ambiguous overall configuration. If you want to distribute this
    package, please make sure that 'thinc.extra' is explicitly added
    to the `packages` configuration field.

    Alternatively, you can also rely on setuptools' discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

    If you don't want 'thinc.extra' to be distributed and are
    already explicitly excluding 'thinc.extra' via
    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
    you can try to use `exclude_package_data`, or `include-package-data=False` in
    combination with a more fine grained `package-data` configuration.

    You can read more about "package data files" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


    [^1]: For Python, any directory (with suitable naming) can be imported,
    even if it does not contain any `.py` files.
    On the other hand, currently there is no concept of package data
    directory, all directories are treated like packages.
    ********************************************************************************

    !!
    check.warn(importable)
    C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\setuptools\command\build_py.py:215: _Warning: Package 'thinc.layers' is absent from the `packages` configuration.
    !!

    ********************************************************************************
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'thinc.layers' as an importable package[^1],
    but it is absent from setuptools' `packages` configuration.

    This leads to an ambiguous overall configuration. If you want to distribute this
    package, please make sure that 'thinc.layers' is explicitly added
    to the `packages` configuration field.

    Alternatively, you can also rely on setuptools' discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

    If you don't want 'thinc.layers' to be distributed and are
    already explicitly excluding 'thinc.layers' via
    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
    you can try to use `exclude_package_data`, or `include-package-data=False` in
    combination with a more fine grained `package-data` configuration.

    You can read more about "package data files" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


    [^1]: For Python, any directory (with suitable naming) can be imported,
    even if it does not contain any `.py` files.
    On the other hand, currently there is no concept of package data
    directory, all directories are treated like packages.
    ********************************************************************************

    !!
    check.warn(importable)
    C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\setuptools\command\build_py.py:215: _Warning: Package 'thinc.tests.mypy.configs' is absent from the `packages` configuration.
    !!

    ********************************************************************************
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'thinc.tests.mypy.configs' as an importable package[^1],
    but it is absent from setuptools' `packages` configuration.

    This leads to an ambiguous overall configuration. If you want to distribute this
    package, please make sure that 'thinc.tests.mypy.configs' is explicitly added
    to the `packages` configuration field.

    Alternatively, you can also rely on setuptools' discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

    If you don't want 'thinc.tests.mypy.configs' to be distributed and are
    already explicitly excluding 'thinc.tests.mypy.configs' via
    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
    you can try to use `exclude_package_data`, or `include-package-data=False` in
    combination with a more fine grained `package-data` configuration.

    You can read more about "package data files" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


    [^1]: For Python, any directory (with suitable naming) can be imported,
    even if it does not contain any `.py` files.
    On the other hand, currently there is no concept of package data
    directory, all directories are treated like packages.
    ********************************************************************************

    !!
    check.warn(importable)
    copying thinc\__init__.pxd -> build\lib.win-amd64-cpython-38\thinc
    copying thinc\py.typed -> build\lib.win-amd64-cpython-38\thinc
    copying thinc\backends\cblas.cpp -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\cpu_kernels.hh -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\linalg.cpp -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\numpy_ops.cpp -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\extra\search.cpp -> build\lib.win-amd64-cpython-38\thinc\extra
    copying thinc\layers\premap_ids.cpp -> build\lib.win-amd64-cpython-38\thinc\layers
    copying thinc\layers\sparselinear.cpp -> build\lib.win-amd64-cpython-38\thinc\layers
    copying thinc\backends\__init__.pxd -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\_custom_kernels.cu -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\_murmur3.cu -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\cblas.pxd -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\cblas.pyx -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\linalg.pxd -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\linalg.pyx -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\numpy_ops.pxd -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\backends\numpy_ops.pyx -> build\lib.win-amd64-cpython-38\thinc\backends
    copying thinc\extra\__init__.pxd -> build\lib.win-amd64-cpython-38\thinc\extra
    copying thinc\extra\search.pxd -> build\lib.win-amd64-cpython-38\thinc\extra
    copying thinc\extra\search.pyx -> build\lib.win-amd64-cpython-38\thinc\extra
    copying thinc\layers\premap_ids.pyx -> build\lib.win-amd64-cpython-38\thinc\layers
    copying thinc\layers\sparselinear.pyx -> build\lib.win-amd64-cpython-38\thinc\layers
    copying thinc\extra\tests\c_test_search.pyx -> build\lib.win-amd64-cpython-38\thinc\extra\tests
    creating build\lib.win-amd64-cpython-38\thinc\tests\mypy\configs
    copying thinc\tests\mypy\configs\mypy-default.ini -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\configs
    copying thinc\tests\mypy\configs\mypy-plugin.ini -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\configs
    creating build\lib.win-amd64-cpython-38\thinc\tests\mypy\outputs
    copying thinc\tests\mypy\outputs\fail-no-plugin.txt -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\outputs
    copying thinc\tests\mypy\outputs\fail-plugin.txt -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\outputs
    copying thinc\tests\mypy\outputs\success-no-plugin.txt -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\outputs
    copying thinc\tests\mypy\outputs\success-plugin.txt -> build\lib.win-amd64-cpython-38\thinc\tests\mypy\outputs
    running build_ext
    C:\Users\scrht\AppData\Local\Temp\pip-build-env-_hk7kebr\overlay\Lib\site-packages\setuptools\command\build_py.py:215: _Warning: Package 'thinc.tests.mypy.outputs' is absent from the `packages` configuration.
    !!

    ********************************************************************************
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'thinc.tests.mypy.outputs' as an importable package[^1],
    but it is absent from setuptools' `packages` configuration.

    This leads to an ambiguous overall configuration. If you want to distribute this
    package, please make sure that 'thinc.tests.mypy.outputs' is explicitly added
    to the `packages` configuration field.

    Alternatively, you can also rely on setuptools' discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

    If you don't want 'thinc.tests.mypy.outputs' to be distributed and are
    already explicitly excluding 'thinc.tests.mypy.outputs' via
    `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
    you can try to use `exclude_package_data`, or `include-package-data=False` in
    combination with a more fine grained `package-data` configuration.

    You can read more about "package data files" on setuptools documentation page:

    - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


    [^1]: For Python, any directory (with suitable naming) can be imported,
    even if it does not contain any `.py` files.
    On the other hand, currently there is no concept of package data
    directory, all directories are treated like packages.
    ********************************************************************************

    !!
    check.warn(importable)
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for thinc
    Failed to build thinc
    ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (thinc)


    python 3.8.0 and pip 24.1.2

    I tried to install some old versions of spaCy, but it didn't help me (the problem appears again). I'm trying to install Virtual Studio Tools.

    Continue reading...

Compartilhe esta Página