2

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)

5
  • Microsoft Visual C++ 14.0 is required. Get it with <link> ... And nvcc not in path, would mean it would also need something to be installed Commented Oct 9, 2020 at 19:27
  • If says nvcc not in path. Did you check if running nvcc does anything on command line? I am not familiar with the program, but it seems it assumes something like nvcc.exe to be found in your Windows Path. Probably you have to add an environment variable called CUDA_INC_DIR pointing to a directory which contains this nvcc.exe. Also, it says I have detected that you have not run configure.py so probably you need to run python configure.py before this step.
    – Niko Fohr
    Commented Oct 9, 2020 at 19:28
  • Have you read the official documentation for installation here? Did you do all the steps mentioned there, like editing your PATH and nvcc.profile ?
    – Niko Fohr
    Commented Oct 9, 2020 at 19:32
  • 1) The link leads to a 404 page 2) I have no idea what "nvcc.exe" is about 3) The official documentation does not cover windows 10, so I'm not sure what to do with it
    – Julio974
    Commented Oct 9, 2020 at 19:36
  • Strange. To me the link still works. Perhaps there was just a temporary hiccup in the connection. The nvcc seems to mean "NVidia's compiler" (which I read behind the link).
    – Niko Fohr
    Commented Oct 9, 2020 at 19:39

1 Answer 1

13

Try the following.

pip install pipwin
pipwin install pycuda
1
  • 1
    This is definitely the solution. Thanks mate.
    – HabibS
    Commented Jun 25, 2023 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.