简体   繁体   English

在 windows 上安装 pycuda

[英]Installing pycuda on windows

So I try python -m pip install pycuda and it fails (Here's some of the output from the failed install):所以我尝试python -m pip install pycuda但它失败了(这是失败安装中的一些 output):

Building wheel for pycuda (pyproject.toml) ... error
  error: subprocess-exited-with-error

WARNING: nvcc not in path.

ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects

I have installed the Visual Studio 2022 build tools but I have not added anything to my path, which is all I figure I have todo but I don't know what I have to add.我已经安装了 Visual Studio 2022 构建工具,但我没有在我的路径中添加任何东西,这是我认为我必须做的所有事情,但我不知道我必须添加什么。 The pycuda wiki's installation page specifies pycuda wiki的安装页面指定

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;

but I don't have those directories.但我没有那些目录。 Here's the tree of my visual studio install D:\VisualStudioThings\install\VC .这是我的视觉工作室安装树D:\VisualStudioThings\install\VC (I cannot include the tree for the whole install because it's too much) (我不能在整个安装中包含树,因为它太多了)

Common7
CoreCon
DIA SDK
ImportProjects
Licenses
Microsoft Azure Tools
MSBuild
SDK
Team Tools
VB
VC
VC#
VSSDK
Xml

VC
├───Auxiliary
│   ├───Build
│   └───VS
│       ├───include
│       │   └───CppCoreCheck
│       ├───lib
│       │   ├───arm
│       │   ├───onecore
│       │   │   ├───arm
│       │   │   ├───x64
│       │   │   └───x86
│       │   ├───x64
│       │   └───x86
│       └───UnitTest
│           ├───include
│           │   ├───UWP
│           │   └───v150
│           └───lib
│               ├───ARM
│               ├───ARM64
│               ├───UWP
│               │   ├───arm
│               │   ├───arm64
│               │   └───x64
│               ├───x64
│               └───x86
├───Redist
│   └───MSVC
│       ├───14.34.31931
│       │   ├───Auxiliary
│       │   ├───debug_nonredist
│       │   │   ├───x64
│       │   │   │   ├───Microsoft.VC143.DebugCRT
│       │   │   │   ├───Microsoft.VC143.DebugCXXAMP
│       │   │   │   ├───Microsoft.VC143.DebugOpenMP
│       │   │   │   └───Microsoft.VC143.OpenMP.LLVM
│       │   │   └───x86
│       │   │       ├───Microsoft.VC143.DebugCRT
│       │   │       ├───Microsoft.VC143.DebugCXXAMP
│       │   │       ├───Microsoft.VC143.DebugOPENMP
│       │   │       └───Microsoft.VC143.OpenMP.LLVM
│       │   ├───onecore
│       │   │   ├───debug_nonredist
│       │   │   │   ├───x64
│       │   │   │   │   ├───Microsoft.VC143.DebugCRT
│       │   │   │   │   └───Microsoft.VC143.DebugOpenMP
│       │   │   │   └───x86
│       │   │   │       ├───Microsoft.VC143.DebugCRT
│       │   │   │       └───Microsoft.VC143.DebugOPENMP
│       │   │   ├───x64
│       │   │   │   ├───Microsoft.VC143.CRT
│       │   │   │   └───Microsoft.VC143.OpenMP
│       │   │   └───x86
│       │   │       ├───Microsoft.VC143.CRT
│       │   │       └───Microsoft.VC143.OPENMP
│       │   ├───x64
│       │   │   ├───Microsoft.VC143.CRT
│       │   │   ├───Microsoft.VC143.CXXAMP
│       │   │   └───Microsoft.VC143.OpenMP
│       │   └───x86
│       │       ├───Microsoft.VC143.CRT
│       │       ├───Microsoft.VC143.CXXAMP
│       │       └───Microsoft.VC143.OPENMP
│       └───v143
└───Tools
    ├───Llvm
    │   ├───bin
    │   └───x64
    │       └───bin
    └───MSVC
        └───14.34.31933
            ├───Auxiliary
            ├───bin
            │   ├───Hostx64
            │   │   ├───x64
            │   │   │   ├───1033
            │   │   │   └───onecore
            │   │   └───x86
            │   │       └───1033
            │   └───Hostx86
            │       ├───x64
            │       │   └───1033
            │       └───x86
            │           └───1033
            ├───crt
            │   └───src
            │       ├───concrt
            │       ├───i386
            │       ├───linkopts
            │       ├───stl
            │       ├───vccorlib
            │       ├───vcruntime
            │       └───x64
            ├───include
            │   ├───cliext
            │   ├───CodeAnalysis
            │   ├───cvt
            │   ├───experimental
            │   ├───fuzzer
            │   ├───Manifest
            │   ├───msclr
            │   │   └───com
            │   └───sanitizer
            └───lib
                ├───onecore
                │   ├───arm
                │   ├───x64
                │   └───x86
                ├───x64
                │   ├───onecore
                │   ├───store
                │   └───uwp
                └───x86
                    ├───onecore
                    ├───store
                    │   └───references
                    └───uwp

So my question is what do I add to my path?所以我的问题是我应该在路径中添加什么?

I can reproduce your issue:我可以重现你的问题:

在此处输入图像描述

Since you are based on windows, you can try the below steps:由于你是基于windows,你可以尝试以下步骤:

pip install --upgrade pip

pip install --upgrade setuptools wheel

If the above steps still don't make it work on your side, I think the issue should comes from the source doesn't have whl file.如果上述步骤仍然不能使它在你这边工作,我认为问题应该来自源没有whl文件。 Because pip will search package from https://pypi.org/ , but in this place, I don't see the package pycuda has whl there.因为 pip 将从https://pypi.org/搜索 package ,但是在这个地方,我没有看到 package pycuda 在那里。

Based on this, I found whl file of pycuda from other place, download it and install the package via this:基于此,我从其他地方找到了pycuda的whl文件,通过以下方式下载并安装package:

python -m pip install packagefilename.whl

It works well on my side, I can install it at the end:它在我这边运行良好,我可以在最后安装它:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM