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?

有帮助吗?

解决方案

(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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top