You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在AWS SageMaker中安装spaCy遇gcc报错,如何解决?

Fixing spaCy Installation Errors in SageMaker Jupyter Notebooks

Hey there, let's tackle those two installation errors you're facing one by one—they're both tied to missing system-level tools needed to compile spaCy's dependencies. Here's how to fix them:

Why You're Seeing These Errors

  1. gcc: error trying to exec 'cc1plus': execvp: No such file or directory: This happens because your SageMaker instance only has the C compiler (gcc) installed, but spaCy's dependencies require a C++ compiler (g++). The cc1plus binary is a core part of the C++ compiler suite, which is missing here.
  2. gcc: error: murmurhash/mrmr.cpp: No such file or directory: This pops up because you're missing Python development headers and other build tools required to compile low-level libraries like murmurhash (a dependency spaCy uses for efficient hashing).

Step-by-Step Fixes

First, install the necessary build dependencies directly in your Jupyter Notebook cell:

For Amazon Linux 2-based SageMaker Instances (Default)

Run this command to install the C++ compiler and Python development headers:

sudo yum install -y gcc-c++ python3-devel

For Ubuntu-based SageMaker Instances

If you're using an Ubuntu-backed instance, use these commands instead:

sudo apt-get update && sudo apt-get install -y g++ python3-dev

Once those tools are installed, re-run your spaCy installation command:

!pip install spacy

Option 2: Use Conda to Avoid Compilation (Easier Alternative)

If you don't want to deal with compiling from source, use Conda to install a pre-built version of spaCy. Most SageMaker instances come with Conda pre-configured, so run this in a notebook cell:

!conda install -c conda-forge spacy -y

This skips the build process entirely, which avoids both errors in one go.

Verify the Installation

After installation, test that spaCy loads correctly by running:

import spacy
nlp = spacy.load("en_core_web_sm")

If this runs without errors, you're good to go!

内容的提问来源于stack exchange,提问作者Sujay DSa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:57:55