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

安装AlphaGeometry依赖editdistance==0.6.2时遇ValueError报错求助

解决Mac下安装AlphaGeometry依赖editdistance==0.6.2的报错问题

在Mac系统中复现AlphaGeometry以测试奥林匹克和AMC竞赛题时,运行run.sh和run_tests.sh脚本失败,根源是安装依赖editdistance==0.6.2时出现以下报错:

Collecting editdistance==0.6.2 (from -r requirements.txt (line 288))
  Using cached editdistance-0.6.2.tar.gz (31 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      Traceback (most recent call last):
        File "/Users/abinandpalanisamy/Documents/AlphaGeometry/alphageometry/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/abinandpalanisamy/Documents/AlphaGeometry/alphageometry/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/abinandpalanisamy/Documents/AlphaGeometry/alphageometry/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 25, in <module>
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1010, in cythonize
          module_list, module_metadata = create_extension_list(
                                         ^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 845, in create_extension_list
          for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
        File "/private/var/folders/k8/d3yx62m51k538br9ryblzv1w0000gq/T/pip-build-env-m3znlrci/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 117, in nonempty
          raise ValueError(error_msg)
      ValueError: 'editdistance/bycython.pyx' doesn't match any files
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

解决方案

原因分析

editdistance 0.6.2版本的源码包存在文件结构缺陷,且对Python 3.12的兼容性不足,导致Cython编译阶段无法找到指定的源码文件。

  • 方案1:升级editdistance版本
    修改requirements.txt第288行的editdistance==0.6.2为editdistance>=0.7.1(该版本完美兼容Python 3.12),然后重新执行安装命令:

    pip install -r requirements.txt
    

    若AlphaGeometry对版本有严格要求,可尝试editdistance==0.6.3,该版本修复了部分编译问题。

  • 方案2:安装预编译wheel包
    若必须使用0.6.2版本,可直接安装对应Mac架构的预编译wheel包,避免源码编译:

    # 先卸载残留
    pip uninstall -y editdistance
    # Intel Mac
    pip install editdistance==0.6.2 --only-binary :all:
    # M系列(arm64)Mac
    pip install editdistance==0.6.2 --platform macosx_11_0_arm64 --only-binary :all:
    
  • 方案3:修复Cython编译环境(最后尝试)
    若上述方案失效,先更新Cython到兼容版本,再重新编译安装:

    pip install cython==0.29.36
    pip install editdistance==0.6.2
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 00:22:32