5

I am trying to install pycuda in computer with Windows 10 64bits, I installed the GPU Toolkit 9.1 and Anaconda 4.2 with python 3.5 64bits. I installed pycuda using the precompiled package:

pycuda‑2017.1.1+cuda9185‑cp35‑cp35m‑win_amd64.whl

The installation in my Anaconda installation didn't mark any error, but when I try to run a simple example I have problems with the import:

Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycuda.driver as cuda
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\driver.py", line 5, in <module>
    from pycuda._driver import *  # noqa
SystemError: <class 'ImportError'> returned a result with an error set

Any idea??

UPDATE:

I resolve my first problem adding the lib directory of the cuda library to my path:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib

But now I have this error:

Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycuda.driver as cuda
>>> import pycuda.autoinit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\autoinit.py", line 5, in <module>
    cuda.init()
pycuda._driver.Error: cuInit failed: unknown error

SOLVED

I try installing Cudatoolkit 9.2, plus adding the

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib

to path, update my nvidia driver, and install the pycuda pycuda‑2018.1+cuda92148‑cp35‑cp35m‑win_amd64.whl

Now my cuda codes function correctly.

Mauricio Ruiz
  • 322
  • 2
  • 10
  • 1
    Did you activated Anaconda environment? – Ugnius Malūkas Oct 29 '18 at 09:59
  • 1
    Hi Ugnius, I am testing it using spyder ide. – Mauricio Ruiz Oct 29 '18 at 11:17
  • 1
    Have you done this before runnign Spyder in Anaconda environment? https://conda.io/docs/user-guide/tasks/manage-environments.html#activating-an-environment – Ugnius Malūkas Oct 29 '18 at 11:26
  • No, this is the first time I am testing pycuda, before I used spyder with other libraries without problems. – Mauricio Ruiz Oct 29 '18 at 11:39
  • 1
    But are you sure that you running Python in Conda? As far as I remeber, write in terminal / cmd: `python --version`. It should be word Conda. Because, I am pretty sure that you running code not in Conda environment. – Ugnius Malūkas Oct 29 '18 at 13:53
  • Yes Ugnius. I only have one python installed on my pc, my path variabel has the path to python from anaconda installation, when I write python in a cmd terminal I see python 3.5 and anaconda version and finally when I check with where command I obtain only one path, the python in my anaconda installation. – Mauricio Ruiz Oct 29 '18 at 14:54
  • It might help you https://codeyarns.com/2015/02/24/pycuda-error-cuinit-failed/ – Ugnius Malūkas Oct 30 '18 at 08:04
  • Any updates due to current versions of all these software packages? – Trantor Jun 04 '20 at 10:50

0 Answers0