PyCUDA error: cuInit failed


After installing PyCUDA, I tried to run a sample PyCUDA program and got this error:

$ python
Traceback (most recent call last):
  File "", line 1, in <module>
    import pycuda.autoinit
  File "/usr/local/lib/python2.7/dist-packages/pycuda/", line 4, in <module>
pycuda._driver.Error: cuInit failed: unknown


The error refers to line 4 in /usr/local/lib/python2.7/dist-packages/pycuda/ The lines relevant to that error in the file are:

import pycuda.driver as cuda

So, CUDA initialization is failing for some reason. After a bit of Googling, I found that this means that the necessary (CUDA? NVIDIA?) modules were not being loaded into the kernel. NVIDIA provides a modprobe package that can auto-load modules into the kernel as needed.

I installed this package:

$ sudo apt-get install nvidia-modprobe

CUDA was able to initialized immediately after this package was installed, no reboot was needed.

Tried with: PyCUDA 2014.1, CUDA 5.5, NVIDIA 331 drivers, GTX Titan and Ubuntu 14.04


One thought on “PyCUDA error: cuInit failed

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.