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

使用Poetry安装timesynth失败,求助解决symengine构建错误

安装timesynth时的symengine构建错误及解决办法

问题详情

执行poetry add timesynth时触发以下构建错误:

Backend subprocess exited when trying to invoke build_wheel

  error: Multiple top-level packages discovered in a flat-layout: ['cmake', 'symengine'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.

  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:

  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names

  To find more information, look for "package discovery" on setuptools docs.

问题根源在于依赖的symengine 0.4.0版本源码布局不符合setuptools自动发现规则,修改本地项目的pyproject.toml(如下列尝试)无法解决该问题:

[tool.setuptools]
py-modules = []

或

[tool.setuptools.packages.find]
where = ["symengine"]
include = ["pkg*", "symengine"]
namespaces = false

环境:Windows 11、Python 3.11

可行解决方案

1. 安装symengine预编译wheel(推荐)

先手动安装适配Windows+Python3.11的symengine预编译wheel,再安装timesynth:

  • 下载对应版本的wheel文件(Python3.11 64位版本)
  • 执行本地安装:
    pip install symengine-0.4.0-cp311-cp311-win_amd64.whl
    
  • 再执行:
    poetry add timesynth
    

2. 通过conda安装symengine

若使用conda环境,先安装指定版本的symengine再添加timesynth:

conda install symengine=0.4.0
poetry add timesynth

3. 降级Python版本到3.10

symengine 0.4.0对Python3.11的支持不完善,降级到Python3.10后,直接执行poetry add timesynth即可正常构建安装。

4. 修改symengine源码构建配置(进阶)

手动修改依赖包的构建配置:

  • 下载symengine 0.4.0的源码包
  • 打开源码根目录的setup.py,添加明确的包声明:
    setup(
        # 保留原有其他配置
        packages=["symengine"],
        exclude=["cmake"]
    )
    
  • 本地构建并安装:
    pip install .
    
  • 再安装timesynth

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 19:45:59