微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法使用pip安装pycuda

如何解决无法使用pip安装pycuda

我正在尝试安装PyCUDA模块以运行我下载的某些python脚本,但是尝试通过pip安装它不起作用。

我在命令行上运行pip install pycuda

首先,我得到了:

Collecting pycuda
    Using cached pycuda-2020.1.tar.gz (1.6 MB)
Requirement already satisfied: pytools>=2011.2 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pycuda) (2020.4)
Requirement already satisfied: decorator>=3.2.0 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pycuda) (4.4.2)
Requirement already satisfied: appdirs>=1.4.0 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pycuda) (1.4.4)
Requirement already satisfied: mako in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pycuda) (1.1.3)
Requirement already satisfied: six>=1.8.0 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pytools>=2011.2->pycuda) (1.11.0)
Requirement already satisfied: numpy>=1.6.0 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from pytools>=2011.2->pycuda) (1.14.1)
Requirement already satisfied: MarkupSafe>=0.9.2 in c:\users\jules\appdata\local\programs\python\python36-32\lib\site-packages (from mako->pycuda) (1.1.1)
Using legacy 'setup.py install' for pycuda,since package 'wheel' is not installed.
Installing collected packages: pycuda
    Running setup.py install for pycuda ... error

然后出现(全部显示为红色):

ERROR: Command errored out with exit status 1:
     command: 'c:\users\jules\appdata\local\programs\python\python36-32\python.exe' -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\Jules\\AppData\\Local\\Temp\\pip-install-rehu_ea2\\pycuda\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jules\\AppData\\Local\\Temp\\pip-install-rehu_ea2\\pycuda\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record 'C:\Users\Jules\AppData\Local\Temp\pip-record-vlpoymu1\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\jules\appdata\local\programs\python\python36-32\Include\pycuda'
         cwd: C:\Users\Jules\AppData\Local\Temp\pip-install-rehu_ea2\pycuda\
    Complete output (82 lines):
    ***************************************************************
    *** WARNING: nvcc not in path.
    *** May need to set CUDA_INC_DIR for installation to succeed.
    ***************************************************************
    *************************************************************
    *** I have detected that you have not run configure.py.
    *************************************************************
    *** Additionally,no global config files were found.
    *** I will go ahead with the default configuration.
    *** In all likelihood,this will not work out.
    ***
    *** See README_SETUP.txt for more information.
    ***
    *** If the build does fail,just re-run configure.py with the
    *** correct arguments,and then retry. Good luck!
    *************************************************************
    *** HIT Ctrl-C Now IF THIS IS NOT WHAT YOU WANT
    *************************************************************
    Continuing in 1 seconds...
    c:\users\jules\appdata\local\programs\python\python36-32\lib\distutils\dist.py:261: UserWarning: UnkNown distribution option: 'test_requires'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.6
    creating build\lib.win32-3.6\pycuda
    copying pycuda\autoinit.py -> build\lib.win32-3.6\pycuda
    copying pycuda\characterize.py -> build\lib.win32-3.6\pycuda
    copying pycuda\compiler.py -> build\lib.win32-3.6\pycuda
    copying pycuda\cumath.py -> build\lib.win32-3.6\pycuda
    copying pycuda\curandom.py -> build\lib.win32-3.6\pycuda
    copying pycuda\debug.py -> build\lib.win32-3.6\pycuda
    copying pycuda\driver.py -> build\lib.win32-3.6\pycuda
    copying pycuda\elementwise.py -> build\lib.win32-3.6\pycuda
    copying pycuda\gpuarray.py -> build\lib.win32-3.6\pycuda
    copying pycuda\reduction.py -> build\lib.win32-3.6\pycuda
    copying pycuda\scan.py -> build\lib.win32-3.6\pycuda
    copying pycuda\tools.py -> build\lib.win32-3.6\pycuda
    copying pycuda\_cluda.py -> build\lib.win32-3.6\pycuda
    copying pycuda\_mymako.py -> build\lib.win32-3.6\pycuda
    copying pycuda\__init__.py -> build\lib.win32-3.6\pycuda
    creating build\lib.win32-3.6\pycuda\gl
    copying pycuda\gl\autoinit.py -> build\lib.win32-3.6\pycuda\gl
    copying pycuda\gl\__init__.py -> build\lib.win32-3.6\pycuda\gl
    creating build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\cg.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\coordinate.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\inner.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\operator.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\packeted.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\pkt_build.py -> build\lib.win32-3.6\pycuda\sparse
    copying pycuda\sparse\__init__.py -> build\lib.win32-3.6\pycuda\sparse
    creating build\lib.win32-3.6\pycuda\compyte
    copying pycuda\compyte\array.py -> build\lib.win32-3.6\pycuda\compyte
    copying pycuda\compyte\dtypes.py -> build\lib.win32-3.6\pycuda\compyte
    copying pycuda\compyte\__init__.py -> build\lib.win32-3.6\pycuda\compyte
    running egg_info
    writing pycuda.egg-info\PKG-INFO
    writing dependency_links to pycuda.egg-info\dependency_links.txt
    writing requirements to pycuda.egg-info\requires.txt
    writing top-level names to pycuda.egg-info\top_level.txt
    reading manifest file 'pycuda.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching 'doc\source\_static\*.css'
    warning: no files found matching 'doc\source\_templates\*.html'
    warning: no files found matching '*.cpp' under directory 'bpl-subset\bpl_subset\boost'
    warning: no files found matching '*.html' under directory 'bpl-subset\bpl_subset\boost'
    warning: no files found matching '*.inl' under directory 'bpl-subset\bpl_subset\boost'
    warning: no files found matching '*.txt' under directory 'bpl-subset\bpl_subset\boost'
    warning: no files found matching '*.h' under directory 'bpl-subset\bpl_subset\libs'
    warning: no files found matching '*.ipp' under directory 'bpl-subset\bpl_subset\libs'
    warning: no files found matching '*.pl' under directory 'bpl-subset\bpl_subset\libs'
    writing manifest file 'pycuda.egg-info\SOURCES.txt'
    creating build\lib.win32-3.6\pycuda\cuda
    copying pycuda\cuda\pycuda-complex-impl.hpp -> build\lib.win32-3.6\pycuda\cuda
    copying pycuda\cuda\pycuda-complex.hpp -> build\lib.win32-3.6\pycuda\cuda
    copying pycuda\cuda\pycuda-helpers.hpp -> build\lib.win32-3.6\pycuda\cuda
    copying pycuda\sparse\pkt_build_cython.pyx -> build\lib.win32-3.6\pycuda\sparse
    running build_ext
    building '_driver' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\jules\appdata\local\programs\python\python36-32\python.exe' -u -c 'import sys,'"'"'exec'"'"'))' install --record 'C:\Users\Jules\AppData\Local\Temp\pip-record-vlpoymu1\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\jules\appdata\local\programs\python\python36-32\Include\pycuda' Check the logs for full command output.

我不知道此错误的含义或解决方法(并且我不想进入复杂的安装过程,这将花费我数小时甚至可能无法正常工作)。我什至不知道这个模块做什么(还)。你有帮助我的主意吗?

(编辑:我在Windows 10上,之前没有安装有关PyCUDA的任何东西)

解决方法

尝试以下操作。

pip install pipwin
pipwin install pycuda

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。