首页 > 编程问答 >我在 pip install flash-attn 抛出错误时遇到错误

我在 pip install flash-attn 抛出错误时遇到错误

时间:2024-07-21 13:19:55浏览次数:11  
标签:python windows flash model large-language-model

  1. 在此输入代码我当前正在尝试安装 “microsoft/Florence-2-large”模型并遵循文档 在其 github 页面上提供。运行 pip install 时 flash-attn --no-build-isolation 我抛出此错误:
Collecting flash_attn   Using cached flash_attn-2.5.9.post1.tar.gz
(2.6 MB)   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   ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\manik\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py",
line 353, in <module>
          main()
        File "C:\Users\manik\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py",
line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\manik\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py",
line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\manik\AppData\Local\Temp\pip-build-env-rifgc3eo\overlay\Lib\site-packages\setuptools\build_meta.py",
line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\manik\AppData\Local\Temp\pip-build-env-rifgc3eo\overlay\Lib\site-packages\setuptools\build_meta.py",
line 297, in _get_build_requires
          self.run_setup()
        File "C:\Users\manik\AppData\Local\Temp\pip-build-env-rifgc3eo\overlay\Lib\site-packages\setuptools\build_meta.py",
line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\manik\AppData\Local\Temp\pip-build-env-rifgc3eo\overlay\Lib\site-packages\setuptools\build_meta.py",
line 313, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
      ModuleNotFoundError: No module named 'packaging'
      [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.

安装 flash-attn 时遇到的错误是因为你的环境中缺少 packaging 包,而 flash-attn 在构建过程中需要这个包。

以下是解决这个问题的步骤:

  1. 安装 packaging 包: 打开你的命令行或终端,运行以下命令:

bash pip install packaging 这会安装 packaging 包及其依赖。

  1. 重新安装 flash-attn 安装完 packaging 后,再次运行安装 flash-attn 的命令:

bash pip install flash-attn --no-build-isolation

这次安装应该会成功。

如果问题仍然存在,请尝试以下步骤:

  • 升级 pip: 确保你使用的是最新版本的 pip 。 运行 pip install --upgrade pip 来升级。
  • 创建新的虚拟环境: 在新的虚拟环境中安装 flash-attn 可以避免与其他包的冲突。
  • 检查 CUDA 版本: flash-attn 需要 CUDA 支持。 确保你已经安装了兼容版本的 CUDA 和 cuDNN。

希望这些步骤能帮你解决问题!

标签:python,windows,flash,model,large-language-model
From: 78688150

相关文章

  • 如何在 Windows 中获取 virtualenv 的路径?
    首先,我在Windows中使用Bash。我正在尝试在VSCode中编写virtualenv的正确路径,但我一定做错了什么。"python.pythonPath":"C\\Users\\Angel\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\\LocalState\\rootfs\\home\......
  • Windows server 2012 设置开机自动登陆并启动启动程序
    设置开机自动登陆按住Win键,再按R键(Win+R),启动”运行”窗口;WindowsXP/2003/2008/2008R2输入”controluserpasswords2″(不含引号)回车;Windows7输入”netplwiz”(不含引号),回车;在”用户帐户”-“用户”界面中,取消”要使用本机,用户必须输入用户名和密码(E)”复选框;按”......
  • 用 python 抓取谷歌结果统计
    我想从谷歌获取关键字的估计结果数。我使用Python3.3并尝试使用BeautifulSoup和urllib.request完成此任务。到目前为止,这是我的简单代码defnumResults():try:page_google='''http://www.google.de/#output=search&sclient=psy-ab&q=pokerbonus&oq=pokerbonus&gs......
  • 【python】Python高阶函数--sorted函数的高阶用法解析与应用实战
    ✨✨欢迎大家来到景天科技苑✨✨......
  • 超详细Python教程——异步任务和定时任务
    异步任务和定时任务在Web应用中,如果一个请求执行了耗时间的操作或者该请求的执行时间无法确定,而且对于用户来说只需要知道服务器接收了他的请求,并不需要马上得到请求的执行结果,这样的操作我们就应该对其进行异步化处理。如果说使用缓存是优化网站性能的第一要义,那么将耗时......
  • Python 中的模 (%) 运算符如何处理负数?
    %运算符在Python中到底是如何工作的,特别是在涉及负数时?例如,为什么-5%4求值为3,而不是-1?在Python中,模运算符(%)遵循以下规则:a%b=a-(b*floor(a/b))其中:a是被除数。......
  • 如何使用 python 更新设备孪生?
    我目前正在尝试使用python更新设备孪生中的属性。但由于SSL错误而无法执行此操作。下面是代码fromazure.iot.hubimportIoTHubRegistryManagerimportcertifiimportssl#ConnecttoIoTHubandsendmessagetodeviceCONNECTION_STRING="HostName=iothub-j......
  • 【Python将字符串连接在一起】
    当然,Python是一个功能丰富且灵活的语言,有许多技巧和最佳实践可以帮助你更有效地编写代码。以下是一些常见的Python技巧:列表推导式(ListComprehensions):这是一种简洁的构建列表的方法。它比使用循环更加清晰和Pythonic。[x*2forxinrange(5)]#输出:[0,2,4,6,......
  • 我心中的王者:Python-第2章 认识变量与基本数学运算
    我心中的王者:Python-第2章认识变量与基本数学运算本章将从基本数学运算开始,一步一步讲解变量的使用与命名,接着介绍Python的算术运算。2-1用Python做计算假设读者到麦当劳打工,一小时可以获得120元时薪,如果想计算一天工作8小时,可以获得多少工资?我们可以用计算器执行“1......
  • 【论文阅读笔记】大模型微调——《LoRA: Low-Rank Adaptation of Large Language Mode
    论文地址:https://arxiv.org/abs/2106.09685代码地址:https://github.com/microsoft/LoRA目录IntroductionMotivationMethodExperimentsFurtherdiscusion感想IntroductionMotivationMethodExperimentsFurtherdiscusion个人认为本篇的精髓所在,能够引用5k+的原因之一感......