2

I'm trying to use the cudamat library and I can't figure out how to use it from within Spyder. I have included the cudamat folder contents in my working directory, but when I try:

import cudamat as cm

I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cudamat/__init__.py", line 1, in <module>
    from cudamat import *
  File "cudamat/cudamat.py", line 7, in <module>
    _cudamat = ct.cdll.LoadLibrary('libcudamat.so')
  File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcudamat.so: cannot open shared object file: No such file or directory

When I run the my script using python from a console window, it works fine. To the best of my knowledge, I have set the working directory of Spyder to the correct location, which contains libcudamat.so.

Any ideas?

user1489497
  • 127
  • 9
  • I don't know much about Spyder but python can often rely on different variables for locating native libraries (see http://stackoverflow.com/questions/1099981/why-cant-python-find-shared-objects-that-are-in-directories-in-sys-path). I would look around and see if there are any options for modifying the native search path in addition to the standard PYTHONPATH-like variables. – Pace Apr 20 '13 at 03:07

1 Answers1

2

(Spyder dev here): You need to start Spyder from a console, so that it can grab its environment variables. I guess cudamat is not installed in a regular location and that's why Spyder can't find it by default.

Note: This is an Spyder limitation (i.e. not being able to read environment variables) that we plan to fix in the future.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124