OpenInformix / IfxPy

Informix native Python driver for scalable enterprise and IoT solutions.
Other
46 stars 22 forks source link

CSDK/ODBC driver files aren't copied to site-packages on Arch Linux #57

Open pepperblue opened 3 years ago

pepperblue commented 3 years ago

Installing IfxPy on Arch Linux the CSDK/ODBC driver files aren't copied to site-packages. As far as I was able to track that down the path-generation for the extraction of the CSDK/ODBC driver archive goes "wrong". One piece of the path is retrieved via platform.processor() which calls uname -p which returns "unknown" at least on Arch Linux and Debian ... Changing platform.processor() to platform.machine() in setup.py solves this issue for me - alternatively using py_cpuinfo could be worth considering ...

arachan commented 3 years ago

ifxPy v3.0.5 don't need install Informix CSDK. But,Cannot connect informix.

I tried Debian10. Don't connect Informix Database. Don't load shared library. Don't copy CSDK/ODBC driver to site-package. Nothing onedb-odbc-driver.

import IfxPy

ConStr="SERVER=servername;DATABASE=dbname;HOST=hostip;SERVICE=port;UID=id;PWD=pw;PROTOCOL=onsoctcp;DB_LOCALE=ja_jp.sjis-s"

try:
    # netstat -a | findstr  9088
    conn = IfxPy.connect( ConStr, "", "")
except Exception as e:
    print ('ERROR: Connect failed')
    print ( e )
    quit()
(.venv) portal@pxeserver:~/py/ifxtest/ifxtest$ python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import IfxPy
ImportError: libifdmr.so: cannot open shared object file: No such file or directory
$ pwd
/home/portal/py/ifxtest/.venv/lib/python3.7/site-packages

$ ls -l
total 1016
drwxr-xr-x 2 portal portal   4096 Mar  9 11:41 IfxPy-3.0.5.dist-info
-rwxr-xr-x 1 portal portal 473912 Mar  9 11:41 IfxPy.cpython-37m-x86_64-linux-gnu.so
-rw-r--r-- 1 portal portal  56896 Mar  9 11:41 IfxPyDbi.py
drwxr-xr-x 2 portal portal   4096 Mar  9 11:41 __pycache__
drwxr-xr-x 3 portal portal   4096 Mar  9 11:40 _distutils_hack
drwxr-xr-x 8 portal portal   4096 Mar  9 11:40 _pytest
-rw-r--r-- 1 portal portal     18 Mar  9 11:39 _virtualenv.pth
-rw-r--r-- 1 portal portal   5662 Mar  9 11:39 _virtualenv.py
drwxr-xr-x 3 portal portal   4096 Mar  9 11:40 attr
drwxr-xr-x 2 portal portal   4096 Mar  9 11:40 attrs-20.3.0.dist-info
-rw-r--r-- 1 portal portal    152 Mar  9 11:39 distutils-precedence.pth
drwxr-xr-x 3 portal portal   4096 Mar  9 11:40 importlib_metadata
drwxr-xr-x 2 portal portal   4096 Mar  9 11:40 importlib_metadata-3.7.2.dist-info
drwxr-xr-x 3 portal portal   4096 Mar  9 11:40 more_itertools
drwxr-xr-x 2 portal portal   4096 Mar  9 11:40 more_itertools-8.7.0.dist-info
drwxr-xr-x 3 portal portal   4096 Mar  9 11:40 packaging
drwxr-xr-x 2 portal portal   4096 Mar  9 11:40 packaging-20.9.dist-info  
..etc...

I tried Windows10 too. Copy onedb-odbc-driver. But Don't connect Informix. Don't load ifxpy. Don't load DLL Library.

 PS> ls

    ディレクトリ: C:\Users\yusuke\git\sample\.venv\Lib\site-packages

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2021/03/05     11:36                certifi
d-----        2021/03/05     11:36                certifi-2020.12.5.dist-info
d-----        2021/03/05     11:36                chardet
d-----        2021/03/05     11:36                chardet-4.0.0.dist-info
d-----        2021/03/05     11:36                idna
d-----        2021/03/05     11:36                idna-2.10.dist-info
d-----        2021/03/09     12:55                IfxPy-3.0.5-py3.9.egg-info
d-----        2021/03/09     12:55                onedb-odbc-driver
d-----        2021/03/05     11:37                pip
d-----        2021/03/05     11:37                pip-21.0.1.dist-info
...etc...

I tried this code on Windows10.

import IfxPy

ConStr="SERVER=SERVERNAME;DATABASE=DBNAME;HOST=IP;SERVICE=21435;UID=ID;PWD=PWD;PROTOCOL=onsoctcp;DB_LOCALE=ja_jp.sjis-s"

try:
    conn = IfxPy.connect( ConStr, "", "")
except Exception as e:
    print ('ERROR: Connect failed')
    print ( e )
    quit()
ImportError: DLL load failed while importing IfxPy: 指定されたモジュールが見つかりません。
deokershesh commented 3 years ago

@arachan, You might want to look previous issue "#41, ImportError: DLL load failed while importing IfxPy: The specified module could not be found."

deokershesh commented 3 years ago

@pepperblue, Yes, it would make more sense to replace platform.processor() with platform.machine(). The below article confirms platform.processor() not available on all platforms.

"Note: Many platforms do not provide this information. eg-NetBSD"

https://www.geeksforgeeks.org/platform-module-in-python/

plitter commented 2 years ago

I'm experiencing the same issue. Building manually with wheel seems to work, but it would be nice that this just worked...