简体   繁体   中英

Can't install pycuda with pip

I am trying to install the PyCUDA module to run some python script I downloaded, but trying to install it with pip doesn't work.

I run pip install pycuda on the command line

At first, I get this:

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

Then, this appears (all in red):

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, 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' Check the logs for full command output.

I have no idea what this error is about, or how to fix it (and I don't want to get into complicated installations that will take me hours and might not even work). I'm not even sure what this module does (yet). Do you have an idea to help me?

(edit: I'm on Windows 10, and I have not installed anything about PyCUDA before)

Try the following.

pip install pipwin
pipwin install pycuda

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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