李锋镝的博客 - LiFengdi.Com

  • 首页
  • 时间轴
  • 留言
  • 左邻右舍
  • 我的日常
  • 关于我
寄蜉蝣于天地 渺沧海之一粟
挫其锐 解其纷 和其光 同其尘
  1. 首页
  2. 原创
  3. 异常
  4. 正文

hnswlib installation failed

2023年5月26日 3173点热度 2人点赞 2条评论

用Python做langflow的时候,遇到一个奇怪的问题:
Mac 英特尔芯片的本子,导入hnswlib依赖的时候报错
环境:python3
错误信息:

Building wheels for collected packages: hnswlib
  Building wheel for hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating var
      creating var/folders
      creating var/folders/cv
      creating var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn
      creating var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpjn2j37vr.cpp -o var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpjn2j37vr.o -std=c++14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpvj2j9km2.cpp -o var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpvj2j9km2.o -fvisibility=hidden
      building 'hnswlib' extension
      creating build
      creating build/temp.macosx-10.9-universal2-cpython-39
      creating build/temp.macosx-10.9-universal2-cpython-39/python_bindings
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/private/var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/pip-build-env-8f2y000v/overlay/lib/python3.9/site-packages/pybind11/include -I/private/var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/pip-build-env-8f2y000v/overlay/lib/python3.9/site-packages/numpy/core/include -I./hnswlib/ -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c ./python_bindings/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-39/./python_bindings/bindings.o -O3 -march=native -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO=\"0.7.0\" -std=c++14 -fvisibility=hidden
      clang: error: the clang compiler does not support '-march=native'
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

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

解决办法:

export HNSWLIB_NO_NATIVE=1
除非注明,否则均为李锋镝的博客 - LiFengdi.Com原创文章,转载必须以链接形式标明本文链接
本文链接:https://www.lifengdi.com/archives/article/exception/4051
本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: Python
最后更新:2023年5月26日

李锋镝

既然选择了远方,便只顾风雨兼程。

打赏 点赞
< 上一篇
guest
您的姓名(必填)
您的邮箱(必填)
您的站点
guest
您的姓名(必填)
您的邮箱(必填)
您的站点
2 评论
最热
最新 最旧
Inline Feedbacks
查看所有评论
王光卫博客
王光卫博客
VIP
2023年6月6日 13:12

排错也是个耐心的工作啊,ChatGPT有时候也能解决简单的问题,复杂了又要烧脑

0
0
回复
李锋镝
李锋镝
博主
回复  王光卫博客
2023年6月6日 18:28

@王光卫博客 确实很烧脑,头发头快秃了

0
0
回复
我的
我的淘宝精品店

春宵一刻值千金,花有清香月有阴。
歌管楼台声细细,秋千院落夜沉沉。

最新 热点 随机
最新 热点 随机
2023年10月13号小记 《人生海海》读后感 人生天地间,忽如远行客。 九月你好 知足常足,知止常止。 笑一笑吧 总会过去的
今天,是我的第三十一个生日一眨眼就三年了……小记hnswlib installation failed2023.7.5 - 2023.7.7笑一笑吧 总会过去的
Hibernate、MyBatis的简介、区别以及优化 GitLab创建新项目,初次提交命令和流程 2023年10月13号小记 Redis的主从同步及Redis Cluster(集群)下的高可用 一线技术人的成长思考总结 Java SPI详解
最近评论
亮娃子日志 发布于 1 个月前(10月26日) 年纪越大,看开的越多
博友圈 发布于 2 个月前(10月13日) 写的不错,确实如此!
游戏百科 发布于 3 个月前(09月17日) 谢谢分享
电商系统开发公司 发布于 3 个月前(09月16日) 感谢分享
b2b系统 发布于 3 个月前(09月15日) 三年说长也不长
有情链接
  • 志文工作室
  • 临窗旋墨
  • 旧时繁华
  • 强仔博客
  • 林三随笔
  • 徐艺扬的博客
  • 云辰博客
  • 韩小韩博客
  • 知向前端
  • 林羽凡
  • 情侣头像
  • 哥斯拉
  • 博客录

COPYRIGHT © 2022 lifengdi.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备16004681号-2