DoubangoTelecom / ultimateMICR-SDK

Bank check information extraction/OCR from Magnetic Ink Character Recognition [MICR] (E-13B & CMC-7) using deep learning
https://www.doubango.org/webapps/micr/
Other
51 stars 18 forks source link

Python sample error (No module named '_ultimateMicrSdk') #60

Closed marat-oxs closed 10 months ago

marat-oxs commented 10 months ago

Hello

I'm trying to run provided samples (specifically python), under ubuntu 22.04 on parallels desktop -virtual machine for osx.

First warning were already on building phase (python3 ../../../python/setup.py build_ext --inplace -v):

full build log here, you can see command in first line parallels@ubuntu-linux-22-04-02-desktop:~/Desktop/ultimateMICR-SDK-master/binaries/linux/x86_64$ python3 ../../../python/setup.py build_ext --inplace -v ``` /home/parallels/Desktop/ultimateMICR-SDK-master/binaries/linux/x86_64/../../../python/setup.py:8: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup, Extension /home/parallels/Desktop/ultimateMICR-SDK-master/binaries/linux/x86_64/../../../python/setup.py:9: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead from distutils import sysconfig Your platform: linux running build_ext building '_ultimateMicrSdk' extension creating build creating build/temp.linux-x86_64-3.10 creating build/temp.linux-x86_64-3.10/home creating build/temp.linux-x86_64-3.10/home/parallels creating build/temp.linux-x86_64-3.10/home/parallels/Desktop creating build/temp.linux-x86_64-3.10/home/parallels/Desktop/ultimateMICR-SDK-master creating build/temp.linux-x86_64-3.10/home/parallels/Desktop/ultimateMICR-SDK-master/python x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../../c++ -I/usr/include/python3.10 -c /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx -o build/temp.linux-x86_64-3.10/home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.o /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx: In function ‘swig_type_info* SWIG_MangledTypeQueryModule(swig_module_info*, swig_module_info*, const char*)’: /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:568:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 568 | register size_t l = 0; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:569:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 569 | register size_t r = iter->size - 1; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:572:25: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 572 | register size_t i = (l + r) >> 1; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:575:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 575 | register int compare = strcmp(name, iname); | ^~~~~~~ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx: In function ‘swig_type_info* SWIG_TypeQueryModule(swig_module_info*, swig_module_info*, const char*)’: /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:619:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 619 | register size_t i = 0; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx: In function ‘char* SWIG_PackData(char*, void*, size_t)’: /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:638:33: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 638 | register const unsigned char *u = (unsigned char *) ptr; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:639:33: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 639 | register const unsigned char *eu = u + sz; | ^~ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:641:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 641 | register unsigned char uu = *u; | ^~ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx: In function ‘const char* SWIG_UnpackData(const char*, void*, size_t)’: /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:653:27: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 653 | register unsigned char *u = (unsigned char *) ptr; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:654:33: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 654 | register const unsigned char *eu = u + sz; | ^~ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:656:19: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 656 | register char d = *(c++); | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:657:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 657 | register unsigned char uu; | ^~ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx: In function ‘int SWIG_Python_UnpackTuple(PyObject*, const char*, Py_ssize_t, Py_ssize_t, PyObject**)’: /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:1334:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 1334 | register int i; | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:1344:25: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 1344 | register Py_ssize_t l = PyTuple_GET_SIZE(args); | ^ /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:1354:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 1354 | register int i; | ^ In file included from /usr/include/string.h:535, from /usr/include/python3.10/Python.h:30, from /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:149: In function ‘char* strncpy(char*, const char*, size_t)’, inlined from ‘void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)’ at /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:5499:22, inlined from ‘PyObject* PyInit__ultimateMicrSdk()’ at /home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.cxx:5597:25: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated before terminating nul copying 10 bytes from a string of the same length [-Wstringop-truncation] 95 | return __builtin___strncpy_chk (__dest, __src, __len, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 96 | __glibc_objsize (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~ x86_64-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.10/home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMICR-SDK-API-PUBLIC-SWIG_python.o -L. -lultimate_micr-sdk -o /home/parallels/Desktop/ultimateMICR-SDK-master/binaries/linux/x86_64/_ultimateMicrSdk.so ```

Don't know is it relevant but the generated ultimateMICR-SDK-API-PUB...python.o was created in same folder (linux/x86_64) but under build/temp.linux-x86_64-3.10/home.. and then path similar to where python folder located

Then sample failed with errors

logs: parallels@ubuntu-linux-22-04-02-desktop:~/Desktop/ultimateMICR-SDK-master/samples/python/recognizer$ PYTHONPATH=../../../binaries/linux/x86_64:../../../python LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH python3 recognizer.py --image ../../../assets/images/e13b_1280x720.jpg --format e13b --assets ../../../assets ``` Traceback (most recent call last): File "/home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMicrSdk.py", line 16, in swig_import_helper fp, pathname, description = imp.find_module('_ultimateMicrSdk', [dirname(__file__)]) File "/usr/lib/python3.10/imp.py", line 297, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named '_ultimateMicrSdk' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/parallels/Desktop/ultimateMICR-SDK-master/samples/python/recognizer/recognizer.py", line 27, in import ultimateMicrSdk File "/home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMicrSdk.py", line 26, in _ultimateMicrSdk = swig_import_helper() File "/home/parallels/Desktop/ultimateMICR-SDK-master/python/ultimateMicrSdk.py", line 18, in swig_import_helper import _ultimateMicrSdk ImportError: libtensorflow.so.1: cannot open shared object file: No such file or directory ```

just in case

list of compilers: parallels@ubuntu-linux-22-04-02-desktop:~/Desktop/ultimateMICR-SDK-master/binaries/linux/x86_64$ dpkg --list | grep compiler ``` ii g++ 4:11.2.0-1ubuntu1 amd64 GNU C++ compiler ii g++-11 11.4.0-1ubuntu1~22.04 amd64 GNU C++ compiler ii gcc 4:11.2.0-1ubuntu1 amd64 GNU C compiler ii gcc-11 11.4.0-1ubuntu1~22.04 amd64 GNU C compiler ii gcc-12 12.3.0-1ubuntu1~22.04 amd64 GNU C compiler ii libllvm13:amd64 1:13.0.1-2ubuntu2.2 amd64 Modular compiler and toolchain technologies, runtime library ii libllvm15:amd64 1:15.0.7-0ubuntu0.22.04.3 amd64 Modular compiler and toolchain technologies, runtime library ii libxkbcommon0:amd64 1.4.0-1 amd64 library interface to the XKB compiler - shared library ii rpcsvc-proto 1.4.2-0ubuntu6 amd64 RPC protocol compiler and definitions ```

believe it's something silly that i've missed, will appreciate to any assistance.

DoubangoTelecom commented 10 months ago

Hi, Your logs clearly say that the issue is about libtensorflow.so missing. Please read https://github.com/DoubangoTelecom/ultimateMICR-SDK/tree/master/samples/python/recognizer#examples at the bottom the note. The note about libtensorflow.so is the next line below the command you're using

marat-oxs commented 10 months ago

Meanwhile looks good

Thank you