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

Apple M1 Pro运行Huggingface Models触发Intel MKL致命错误求助

问题:M1 Pro MacBook Pro运行Huggingface Models触发Intel MKL致命错误

环境信息

  • 硬件:搭载M1 Pro处理器的MacBook Pro
  • 系统:macOS Monterey(12.4)
  • Python版本:3.9

错误详情

运行Huggingface Models时弹出以下Intel MKL致命错误:

Intel MKL FATAL ERROR: This system does not meet the minimum requirements for use of the Intel(R) Math Kernel Library.
The processor must support the Intel(R) Supplemental Streaming SIMD Extensions 3 (Intel(R) SSSE3) instructions.
The processor must support the Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) instructions.
The processor must support the Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.

已尝试的无效操作

  • 更新numpy并禁用MKL
  • 卸载后通过pip重装PyTorch
  • 安装nomkl和torch,重装所有必要依赖包(当前conda list输出如下):
ipykernel (6.15.2), 
numpy (1.22.4), 
pandas (1.4.3), 
matplotlib(3.5.3), 
nomkl (1.0), 
pytorch (1.12.1), 
torchvisio(0.11.3), 
nomkl (1.0)

针对性解决方案

核心原因

M1 Pro为ARM架构处理器,Intel MKL仅适配x86架构,现有环境中仍存在依赖MKL的x86转译包,导致冲突。

解决步骤

  1. 创建全新ARM专属conda环境

    conda create -n arm_hf python=3.9
    conda activate arm_hf
    

    确保conda已配置为优先使用arm64架构包:

    conda config --set subdir osx-arm64
    
  2. 安装原生ARM版本的PyTorch
    使用PyTorch官方arm64安装指令:

    conda install pytorch torchvision torchaudio -c pytorch-nightly
    
  3. 安装Huggingface依赖及工具包
    优先通过conda-forge安装arm64原生包:

    conda install -c conda-forge transformers datasets numpy pandas matplotlib ipykernel
    
  4. 验证环境架构
    运行以下命令确认当前Python环境为ARM64架构:

    python -c "import platform; print(platform.machine())"
    

    输出应为arm64

  5. 强制禁用MKL依赖
    终端临时生效:

    export MKL_SERVICE_FORCE_INTEL=0
    

    或在Python脚本开头添加:

    import os
    os.environ['MKL_SERVICE_FORCE_INTEL'] = '0'
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 14:36:16