pyculib icon indicating copy to clipboard operation
pyculib copied to clipboard

import pyculib causes AttributeError

Open antw-cg opened this issue 5 years ago • 5 comments

Unable to import pyculib.

OS: Ubuntu 18.04.2 LTS

Inside a conda env: $ conda install pyculib

Inside jupyter notebook using conda env kernel: import pyculib

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-8e4ff3141e6d> in <module>
      6 import sys
      7 from numba import cuda, jit
----> 8 from pyculib import rand as curand

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/__init__.py in <module>
     47 if cuda_compatible():
     48     from numba import cuda
---> 49     from . import blas, sparse, fft, rand, sorting
     50 
     51 def test():

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/sparse/__init__.py in <module>
      1 from __future__ import print_function, absolute_import
----> 2 from .api import *

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/sparse/api.py in <module>
      4 import scipy.sparse as ss
      5 from numba import cuda
----> 6 from .binding import (cuSparse, CUSPARSE_INDEX_BASE_ZERO,
      7                       CUSPARSE_INDEX_BASE_ONE)
      8 

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/sparse/binding.py in <module>
   1305 
   1306 
-> 1307 cuSparse = _init_cuSparse()

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/sparse/binding.py in _init_cuSparse()
   1290     for k, v in _declarations():
   1291         if k not in _bypassed:
-> 1292             name, func = _init_api_function(k, v)
   1293             assert name not in gv
   1294             gv[name] = func

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/sparse/binding.py in _init_api_function(name, decl)
   1235 
   1236 def _init_api_function(name, decl):
-> 1237     lib = libcusparse()
   1238     mangled = mangle(name)
   1239     for k in globals().keys():

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/utils/libutils.py in __new__(cls)
     23             cls.__singleton = inst
     24             inst.dll = dll
---> 25             inst._initialize()
     26         else:
     27             inst = cls.__singleton

/opt/conda/envs/monte_carlo_env2/lib/python3.6/site-packages/pyculib/utils/libutils.py in _initialize(self)
     32         for name, obj in vars(type(self)).items():
     33             if isinstance(obj, ctype_function):
---> 34                 fn = getattr(self.dll, name)
     35                 fn.restype = obj.restype
     36                 fn.argtypes = obj.argtypes

/opt/conda/envs/monte_carlo_env2/lib/python3.6/ctypes/__init__.py in __getattr__(self, name)
    359         if name.startswith('__') and name.endswith('__'):
    360             raise AttributeError(name)
--> 361         func = self.__getitem__(name)
    362         setattr(self, name, func)
    363         return func

/opt/conda/envs/monte_carlo_env2/lib/python3.6/ctypes/__init__.py in __getitem__(self, name_or_ordinal)
    364 
    365     def __getitem__(self, name_or_ordinal):
--> 366         func = self._FuncPtr((name_or_ordinal, self))
    367         if not isinstance(name_or_ordinal, int):
    368             func.__name__ = name_or_ordinal

AttributeError: /opt/conda/envs/monte_carlo_env2/lib/libcusparse.so.10.3.1.89: undefined symbol: cusparseCaxpyi_v2

Output from $ conda list:

# packages in environment at /opt/conda/envs/monte_carlo_env2:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
blas                      1.0                         mkl  
ca-certificates           2019.11.27                    0  
certifi                   2019.11.28               py36_0  
cffi                      1.13.2           py36h2e261b9_0  
cudatoolkit               10.2.89              hfd86e86_0  
cycler                    0.10.0                   py36_0  
dbus                      1.13.12              h746ee38_0  
expat                     2.2.6                he6710b0_0  
fontconfig                2.13.0               h9420a91_0  
freetype                  2.9.1                h8a8886c_1  
glib                      2.63.1               h5a9c865_0  
gst-plugins-base          1.14.0               hbbd80ab_1  
gstreamer                 1.14.0               hb453b48_1  
icu                       58.2                 h9c2bf20_1  
jpeg                      9b                   h024ee3a_2  
kiwisolver                1.1.0            py36he6710b0_0  
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran               3.0.0                         1  
libpng                    1.6.37               hbc83047_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.13                 h1bed415_1  
libxml2                   2.9.9                hea5a465_1  
llvmlite                  0.30.0           py36hd408876_0  
matplotlib                3.1.1            py36h5429711_0  
mkl                       2017.0.3                      0  
ncurses                   6.1                  he6710b0_1  
numba                     0.46.0           py36h962f231_0  
numpy                     1.13.1                   py36_0  
openssl                   1.1.1d               h7b6447c_3  
pcre                      8.43                 he6710b0_0  
pip                       19.3.1                   py36_0  
pycparser                 2.19                     py36_0  
pyculib                   1.0.2               np113py36_2  
pyculib_sorting           1.0.0                         8  
pyparsing                 2.4.5                      py_0  
pyqt                      5.9.2            py36h05f1152_2  
python                    3.6.9                h265db76_0  
python-dateutil           2.8.1                      py_0  
pytz                      2019.3                     py_0  
qt                        5.9.7                h5867ecd_1  
readline                  7.0                  h7b6447c_5  
scipy                     0.19.1              np113py36_0  
setuptools                44.0.0                   py36_0  
sip                       4.19.8           py36hf484d3e_0  
six                       1.13.0                   py36_0  
sqlite                    3.30.1               h7b6447c_0  
tbb                       2019.8               hfd86e86_0  
tk                        8.6.8                hbc83047_0  
tornado                   6.0.3            py36h7b6447c_0  
wheel                     0.33.6                   py36_0  
xz                        5.2.4                h14c3975_4  
zlib                      1.2.11               h7b6447c_3 

antw-cg avatar Jan 06 '20 23:01 antw-cg

any update on this? I have the same problem

jlyw1017 avatar Apr 26 '20 08:04 jlyw1017

Note that we're encouraging people to migrate to CuPy, which provides wrappers around the same CUDA libraries that pyculib provided, but with a nicer NumPy interface.

seibert avatar Apr 27 '20 16:04 seibert

@seibert CuPy has limited capability for writing Kernels in python. Numba cuda device arrays supposedly works with pyculib functions, so it is better suited for python use.

adquint7 avatar May 30 '20 01:05 adquint7

any update on this? I have the same problem, too

ChenWuOtt avatar Feb 25 '22 02:02 ChenWuOtt

@seibert CuPy has limited capability for writing Kernels in python. Numba cuda device arrays supposedly works with pyculib functions, so it is better suited for python use.

Note that we're encouraging people to migrate to CuPy, which provides wrappers around the same CUDA libraries that pyculib provided, but with a nicer NumPy interface.

i have the same question,but in cupy there is still a question for me ,i need to use BSR_matrix,it can only be used by pyculib not in cupy

fangyezhengwen avatar May 19 '22 08:05 fangyezhengwen