[GH-ISSUE #572] 编译时提示没有设置环境变量CUDA_HOME,但无论是系统中还是conda虚拟环境中都已设置此变量 #419

Open
opened 2026-10-29 14:39:24 +00:00 by bsakaguchi · 5 comments
Owner

Originally created by @boqianzee on GitHub (Feb 21, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/572

报错如下所示:

`Processing c:\models\ktransformers
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
Traceback (most recent call last):
File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 389, in
main()
File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 175, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\setuptools\build_meta.py", line 377, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
exec(code, locals())
File "", line 365, in
ValueError: Unsupported backend: CUDA_HOME and MUSA_HOME are not set.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.`

但事实上系统环境和conda虚拟环境都已设置此变量。

Originally created by @boqianzee on GitHub (Feb 21, 2025). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/572 报错如下所示: `Processing c:\models\ktransformers Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [15 lines of output] Traceback (most recent call last): File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module> main() File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 175, in prepare_metadata_for_build_wheel return hook(metadata_directory, config_settings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\setuptools\build_meta.py", line 377, in prepare_metadata_for_build_wheel self.run_setup() File "C:\softwares\anaconda3\envs\ktransformers\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup exec(code, locals()) File "<string>", line 365, in <module> ValueError: Unsupported backend: CUDA_HOME and MUSA_HOME are not set. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.` 但事实上系统环境和conda虚拟环境都已设置此变量。
Author
Owner

@VERT2022 commented on GitHub (Feb 21, 2025):

WSL下面折腾吧,Windows上面很多莫名其妙的问题

<!-- gh-comment-id:2674276185 --> @VERT2022 commented on GitHub (Feb 21, 2025): WSL下面折腾吧,Windows上面很多莫名其妙的问题
Author
Owner

@deltaww-davehu commented on GitHub (Feb 21, 2025):

确保如下几点:

  1. 显卡安装好。
  2. 安装官方cuda-toolkit, 我的用的是12.6
  3. 确保下面的指令显示带cu字样的字符,我这边输出是‘2.6.0+cu126’
 python -c 'import torch ; print(torch.__version__)'

如果没有cu字样, 那应该是你的pytorch没有安装好。需要重新安装pytorch, (注意,用官方pytorch的地址安装。如果你是直接用Pip 网络安装,确保没有用国内的镜像,必须从国外官方路径下载,否则你下的torch是没有cuda支持的)。

<!-- gh-comment-id:2674666881 --> @deltaww-davehu commented on GitHub (Feb 21, 2025): 确保如下几点: 1. 显卡安装好。 2. 安装官方cuda-toolkit, 我的用的是12.6 3. 确保下面的指令显示带cu字样的字符,我这边输出是‘2.6.0+cu126’ ``` python -c 'import torch ; print(torch.__version__)' ``` 如果没有cu字样, 那应该是你的pytorch没有安装好。需要重新安装pytorch, (注意,用官方pytorch的地址安装。如果你是直接用Pip 网络安装,确保没有用国内的镜像,必须从国外官方路径下载,否则你下的torch是没有cuda支持的)。
Author
Owner

@shijy16 commented on GitHub (Feb 24, 2025):

WSL下面折腾吧,Windows上面很多莫名其妙的问题

确保如下几点:

  1. 显卡安装好。
  2. 安装官方cuda-toolkit, 我的用的是12.6
  3. 确保下面的指令显示带cu字样的字符,我这边输出是‘2.6.0+cu126’
 python -c 'import torch ; print(torch.__version__)'

如果没有cu字样, 那应该是你的pytorch没有安装好。需要重新安装pytorch, (注意,用官方pytorch的地址安装。如果你是直接用Pip 网络安装,确保没有用国内的镜像,必须从国外官方路径下载,否则你下的torch是没有cuda支持的)。

我在ubuntu下也有这个问题,pytorch输出也没有问题"2.6.0+cu124"

<!-- gh-comment-id:2677770187 --> @shijy16 commented on GitHub (Feb 24, 2025): > WSL下面折腾吧,Windows上面很多莫名其妙的问题 > 确保如下几点: > > 1. 显卡安装好。 > 2. 安装官方cuda-toolkit, 我的用的是12.6 > 3. 确保下面的指令显示带cu字样的字符,我这边输出是‘2.6.0+cu126’ > > ``` > python -c 'import torch ; print(torch.__version__)' > ``` > > 如果没有cu字样, 那应该是你的pytorch没有安装好。需要重新安装pytorch, (注意,用官方pytorch的地址安装。如果你是直接用Pip 网络安装,确保没有用国内的镜像,必须从国外官方路径下载,否则你下的torch是没有cuda支持的)。 我在ubuntu下也有这个问题,pytorch输出也没有问题"2.6.0+cu124"
Author
Owner

@knilink commented on GitHub (Mar 3, 2025):

如果是直接运行pip install .没有加--no-build-isolation的话会有这个问题

<!-- gh-comment-id:2693657822 --> @knilink commented on GitHub (Mar 3, 2025): 如果是直接运行`pip install .`没有加`--no-build-isolation`的话会有这个问题
Author
Owner

@MaoJianwei commented on GitHub (Apr 14, 2025):

我也遇到这个问题,安装kTransformers不成功

<!-- gh-comment-id:2800388301 --> @MaoJianwei commented on GitHub (Apr 14, 2025): 我也遇到这个问题,安装kTransformers不成功
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#419
No description provided.