最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

installation - Pip python Cannot install module spaCy - Stack Overflow

programmeradmin0浏览0评论

I wanted to use spacy to work on a project, but it cannot be installed using pip and is showing the following error message in command prompt

pip install spacy
Collecting spacy
  Using cached spacy-3.8.2.tar.gz (1.3 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      Ignoring numpy: markers 'python_version < "3.9"' don't match your environment
      Collecting setuptools
        Using cached setuptools-76.0.0-py3-none-any.whl.metadata (6.7 kB)
      Collecting cython<3.0,>=0.25
        Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
      Collecting cymem<2.1.0,>=2.0.2
        Using cached cymem-2.0.11-cp313-cp313-win_amd64.whl.metadata (8.8 kB)
      Collecting preshed<3.1.0,>=3.0.2
        Using cached preshed-3.0.9.tar.gz (14 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting murmurhash<1.1.0,>=0.28.0
        Using cached murmurhash-1.0.12-cp313-cp313-win_amd64.whl.metadata (2.2 kB)
      Collecting thinc<8.4.0,>=8.3.0
        Using cached thinc-8.3.2.tar.gz (193 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'error'
        error: subprocess-exited-with-error

        pip subprocess to install build dependencies did not run successfully.
        exit code: 1

        [65 lines of output]
        Ignoring numpy: markers 'python_version < "3.9"' don't match your environment
        Collecting setuptools
          Using cached setuptools-76.0.0-py3-none-any.whl.metadata (6.7 kB)
        Collecting cython<3.0,>=0.25
          Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
        Collecting murmurhash<1.1.0,>=1.0.2
          Using cached murmurhash-1.0.12-cp313-cp313-win_amd64.whl.metadata (2.2 kB)
        Collecting cymem<2.1.0,>=2.0.2
          Using cached cymem-2.0.11-cp313-cp313-win_amd64.whl.metadata (8.8 kB)
        Collecting preshed<3.1.0,>=3.0.2
          Using cached preshed-3.0.9.tar.gz (14 kB)
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'done'
        Collecting blis<1.1.0,>=1.0.0
          Using cached blis-1.0.2-cp313-cp313-win_amd64.whl.metadata (7.8 kB)
        Collecting numpy<2.1.0,>=2.0.0
          Using cached numpy-2.0.2.tar.gz (18.9 MB)
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Installing backend dependencies: started
          Installing backend dependencies: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'error'
          error: subprocess-exited-with-error

          Preparing metadata (pyproject.toml) did not run successfully.
          exit code: 1

          [19 lines of output]
          + C:\Users\ronal\AppData\Local\Programs\Python\Python313\python.exe C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\vendored-meson\meson\meson.py setup C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w\meson-python-native-file.ini
          The Meson build system
          Version: 1.4.99
          Source dir: C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e
          Build dir: C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w
          Build type: native build
          Project name: NumPy
          Project version: 2.0.2
          C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW GCC-6.3.0-1) 6.3.0")
          C linker for the host machine: gcc ld.bfd 2.28
          C++ compiler for the host machine: c++ (gcc 6.3.0 "c++ (MinGW GCC-6.3.0-1) 6.3.0")
          C++ linker for the host machine: c++ ld.bfd 2.28
          Cython compiler for the host machine: cython (cython 3.0.12)
          Host machine cpu family: x86
          Host machine cpu: x86

          ..\meson.build:28:4: ERROR: Problem encountered: NumPy requires GCC >= 8.4

          A full log can be found at C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w\meson-logs\meson-log.txt
          [end of output]

          note: This error originates from a subprocess, and is likely not a problem with pip.
        error: metadata-generation-failed

        Encountered error while generating package metadata.

        See above for output.

        note: This is an issue with the package mentioned above, not pip.
        hint: See above for details.
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error

      pip subprocess to install build dependencies did not run successfully.
      exit code: 1

      See above for output.

      note: This error originates from a subprocess, and is likely not a problem with pip.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I have been trying to install spacy module to import into a python backend project. Spacy was not even being installed using

pip install spacy

I am not able to import spacy as it wont be installed using pip due to the problem above as in the terminal response

please someone help me fix this issue

I wanted to use spacy to work on a project, but it cannot be installed using pip and is showing the following error message in command prompt

pip install spacy
Collecting spacy
  Using cached spacy-3.8.2.tar.gz (1.3 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      Ignoring numpy: markers 'python_version < "3.9"' don't match your environment
      Collecting setuptools
        Using cached setuptools-76.0.0-py3-none-any.whl.metadata (6.7 kB)
      Collecting cython<3.0,>=0.25
        Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
      Collecting cymem<2.1.0,>=2.0.2
        Using cached cymem-2.0.11-cp313-cp313-win_amd64.whl.metadata (8.8 kB)
      Collecting preshed<3.1.0,>=3.0.2
        Using cached preshed-3.0.9.tar.gz (14 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting murmurhash<1.1.0,>=0.28.0
        Using cached murmurhash-1.0.12-cp313-cp313-win_amd64.whl.metadata (2.2 kB)
      Collecting thinc<8.4.0,>=8.3.0
        Using cached thinc-8.3.2.tar.gz (193 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'error'
        error: subprocess-exited-with-error

        pip subprocess to install build dependencies did not run successfully.
        exit code: 1

        [65 lines of output]
        Ignoring numpy: markers 'python_version < "3.9"' don't match your environment
        Collecting setuptools
          Using cached setuptools-76.0.0-py3-none-any.whl.metadata (6.7 kB)
        Collecting cython<3.0,>=0.25
          Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
        Collecting murmurhash<1.1.0,>=1.0.2
          Using cached murmurhash-1.0.12-cp313-cp313-win_amd64.whl.metadata (2.2 kB)
        Collecting cymem<2.1.0,>=2.0.2
          Using cached cymem-2.0.11-cp313-cp313-win_amd64.whl.metadata (8.8 kB)
        Collecting preshed<3.1.0,>=3.0.2
          Using cached preshed-3.0.9.tar.gz (14 kB)
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'done'
        Collecting blis<1.1.0,>=1.0.0
          Using cached blis-1.0.2-cp313-cp313-win_amd64.whl.metadata (7.8 kB)
        Collecting numpy<2.1.0,>=2.0.0
          Using cached numpy-2.0.2.tar.gz (18.9 MB)
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Installing backend dependencies: started
          Installing backend dependencies: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'error'
          error: subprocess-exited-with-error

          Preparing metadata (pyproject.toml) did not run successfully.
          exit code: 1

          [19 lines of output]
          + C:\Users\ronal\AppData\Local\Programs\Python\Python313\python.exe C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\vendored-meson\meson\meson.py setup C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w\meson-python-native-file.ini
          The Meson build system
          Version: 1.4.99
          Source dir: C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e
          Build dir: C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w
          Build type: native build
          Project name: NumPy
          Project version: 2.0.2
          C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW. GCC-6.3.0-1) 6.3.0")
          C linker for the host machine: gcc ld.bfd 2.28
          C++ compiler for the host machine: c++ (gcc 6.3.0 "c++ (MinGW. GCC-6.3.0-1) 6.3.0")
          C++ linker for the host machine: c++ ld.bfd 2.28
          Cython compiler for the host machine: cython (cython 3.0.12)
          Host machine cpu family: x86
          Host machine cpu: x86

          ..\meson.build:28:4: ERROR: Problem encountered: NumPy requires GCC >= 8.4

          A full log can be found at C:\Users\ronal\AppData\Local\Temp\pip-install-bpp4n0ch\numpy_744bbb085194411e9f392421c1dd5e5e\.mesonpy-8ls7xc0w\meson-logs\meson-log.txt
          [end of output]

          note: This error originates from a subprocess, and is likely not a problem with pip.
        error: metadata-generation-failed

        Encountered error while generating package metadata.

        See above for output.

        note: This is an issue with the package mentioned above, not pip.
        hint: See above for details.
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error

      pip subprocess to install build dependencies did not run successfully.
      exit code: 1

      See above for output.

      note: This error originates from a subprocess, and is likely not a problem with pip.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I have been trying to install spacy module to import into a python backend project. Spacy was not even being installed using

pip install spacy

I am not able to import spacy as it wont be installed using pip due to the problem above as in the terminal response

please someone help me fix this issue

Share Improve this question asked Mar 12 at 17:10 Ronal GeeRonal Gee 1 1
  • Are you using a dedicated environment for your project ? it seems that you use pip linked to python 3.13 whereas numpy version wants <3.9 – rehaqds Commented Mar 14 at 21:40
Add a comment  | 

2 Answers 2

Reset to default 0

The error message shows you need a newer version of GCC:

NumPy requires GCC >= 8.4

You have GCC 6.3.0 from MinGW, which is too old for NumPy 2.0.2.

Potential Fixes

  1. Use pre-built wheels:

    Instead of building from source you can use pre-compiled package.

    pip install -U pip
    pip install --only-binary=all spacy
    
  2. Try older versions:

    pip install spacy==3.5.3
    

    Or:

    pip install numpy==1.24.3
    pip install spacy
    
  3. Update GCC:

    • Install newer MinGW/MSYS2 with GCC 8.4+
    • Add to PATH
  4. Use conda:

    conda install -c conda-fe spacy
    

From your error message, you were trying to install spacy 3.8.2 using Python 3.13 on a Windows machine. However Spacy 3.8.2 only has wheels for Python 3.9 - 3.12.

It is listed that the latest version (i.e. spacy 3.8.5) supports Python 3.9 - 3.13 but I can only see wheels for Python 3.9 - 3.12 in the latest release.

I suggest you downgrade to Python 3.12 and run pip install spacy again.

发布评论

评论列表(0)

  1. 暂无评论