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

Conda环境下pip安装Chatterbot失败求助:编译依赖构建错误

Chatterbot在Conda环境中pip安装失败的解决方案

问题概述

在Conda环境中使用pip安装Chatterbot时持续失败,核心错误为构建preshed、thinc、blis依赖的wheel包失败,关键报错片段如下:

Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [2578 lines of output]
    # 省略中间依赖收集过程
    Building wheels for collected packages: preshed, thinc, blis
      Building wheel for preshed (setup.py): started
      Building wheel for preshed (setup.py): finished with status 'error'
      error: subprocess-exited-with-error
    
      × python setup.py bdist_wheel did not run successfully.
      │ exit code: 1
      ╰─> [218 lines of output]
          /home/chalo/anaconda3/lib/python3.10/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
          !!
        
                  ********************************************************************************
                  Requirements should be satisfied by a PEP 517 installer.
                  If you are using pip, you can try `pip install --use-pep517`.
                  ********************************************************************************

最终报错信息:

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for blis
Running setup.py clean for blis
Failed to build preshed thinc blis
ERROR: Could not build wheels for preshed, thinc, blis, which is required to install pyproject.toml-based projects

已尝试的无效操作:

  • 将setuptools降级至58.2.0版本
  • 安装cmake并降级pip
  • 运行pip install --use-pep517 setuptools,提示依赖已满足

解决方案

1. 创建兼容Python版本的Conda环境

Chatterbot旧版本对Python3.10+兼容性较差,建议指定Python3.9创建环境:

conda create -n chatterbot_env python=3.9
conda activate chatterbot_env

2. 安装系统级编译依赖(Linux环境)

构建preshed、blis等包需要基础编译工具,执行以下命令安装:

sudo apt-get update && sudo apt-get install build-essential python3-dev libopenblas-dev

3. 手动安装兼容版本的依赖包

直接安装Chatterbot时依赖的旧版thinc、blis无法适配新Python版本,先手动安装兼容版本:

pip install blis==0.7.9 preshed==3.0.8 thinc==8.1.10

4. 安装Chatterbot

依赖安装完成后,执行Chatterbot安装命令:

pip install chatterbot

备选方案:使用维护活跃的fork版本

如果上述方法仍失败,可尝试社区维护的fork版本:

pip install git+https://github.com/gunthercox/ChatterBot.git@v1.0.4

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 19:39:53