OpenInformix / IfxPy

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

Getting requirements to build wheel did not run successfully #81

Open eddpascoal opened 4 weeks ago

eddpascoal commented 4 weeks ago

Hi, when I try to install on

I would get the following error:

Collecting ifxpy==3.0.5
  Downloading IfxPy-3.0.5.tar.gz (155 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      Detected 64-bit Python
      Downloading : https://hcl-onedb.github.io/odbc/OneDB-Linux64-ODBC-Driver.tar
      Extracting Linux ODBC files : https://hcl-onedb.github.io/odbc/OneDB-Linux64-ODBC-Driver.tar
      Smart Triggers are enabled.
      error in IfxPy setup command: use_2to3 is invalid.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Am I missing something here?

jsagrera commented 4 weeks ago

Build it from source:

Informix CSDK needs to be installed somewhere in your system:

informix@lxhost:~/OpenInformix$ echo $INFORMIXDIR
/home/informix/4.50.FC10W1
informix@lxhost:~/OpenInformix$ echo $CSDK_HOME
/home/informix/4.50.FC10W1
informix@lxhost:~/OpenInformix$
informix@lxhost:/OpenInformix$ python3 -V
Python 3.10.14
informix@lxhost:/OpenInformix$ esql -V
IBM Informix CSDK Version 4.50, IBM Informix-ESQL Version 4.50.FC10W1
informix@lxhost:/OpenInformix$

Clone the repo:

informix@lxhost:~/OpenInformix$ git clone https://github.com/OpenInformix/IfxPy.git
Cloning into 'IfxPy'...
remote: Enumerating objects: 2189, done.
remote: Counting objects: 100% (102/102), done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 2189 (delta 55), reused 96 (delta 50), pack-reused 2087
Receiving objects: 100% (2189/2189), 2.56 MiB | 1.66 MiB/s, done.
Resolving deltas: 100% (1624/1624), done.
informix@lxhost:~/OpenInformix$
informix@lxhost:~/OpenInformix$ cd IfxPy/IfxPy/
informix@lxhost:~/OpenInformix/IfxPy/IfxPy$

Build the wheel:

informix@lxhost:~/OpenInformix/IfxPy/IfxPy$ python3 setup.py bdist_wheel  --plat-name manylinux1_x86_64
/home/informix/OpenInformix/IfxPy/IfxPy/setup.py:19: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_python_lib
Detected 64-bit Python
Smart Triggers are enabled.
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
copying IfxPyDbi.py -> build/lib.linux-x86_64-3.10
running build_ext
building 'IfxPy' extension
creating build/temp.linux-x86_64-3.10
x86_64-linux-gnu-gcc -pthread -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 -DHAVE_SMARTTRIGGER -I/home/informix/OpenInformix/IfxPy/IfxPy -I/home/informix/OpenInformix/IfxPy/IfxPy/Include -I/home/informix/4.50.FC10W1/incl/cli -I/usr/include/python3.10 -c ifxpyc.c -o build/temp.linux-x86_64-3.10/ifxpyc.o
ifxpyc.c: In function ‘estrndup’:
ifxpyc.c:158:13: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  158 |     if (len > max)
      |             ^
ifxpyc.c: In function ‘_python_IfxPy_free_conn_struct’:
ifxpyc.c:214:13: warning: assignment to ‘storeSessionID *’ {aka ‘struct <anonymous> *’} from incompatible pointer type
struct storeSessionID *’ [-Wincompatible-pointer-types]
  214 |    tempNode = tempNode->next;
      |             ^
...
...
...
In file included from /usr/include/stdio.h:867,
                 from /usr/include/python3.10/Python.h:25,
                 from ifxpyc.c:39:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 16 and 543 bytes into a destination of size 527
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -pthread -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 -fPIC build/temp.linux-x86_64-3.10/ifxpyc.o -L/home/informix/4.50.FC10W1/lib/cli -L/home/informix/OpenInformix/IfxPy/IfxPy/Lib -lifdmr -lthcli -o build/lib.linux-x86_64-3.10/IfxPy.cpython-310-x86_64-linux-gnu.so
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
copying build/lib.linux-x86_64-3.10/IfxPyDbi.py -> build/bdist.linux-x86_64/wheel
copying build/lib.linux-x86_64-3.10/IfxPy.cpython-310-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel
running install_egg_info
running egg_info
writing IfxPy.egg-info/PKG-INFO
writing dependency_links to IfxPy.egg-info/dependency_links.txt
writing top-level names to IfxPy.egg-info/top_level.txt
reading manifest file 'IfxPy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.pyd'
writing manifest file 'IfxPy.egg-info/SOURCES.txt'
Copying IfxPy.egg-info to build/bdist.linux-x86_64/wheel/IfxPy-3.0.5.egg-info
running install_scripts
adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/IfxPy-3.0.5.dist-info/WHEEL
creating 'dist/IfxPy-3.0.5-cp310-cp310-manylinux1_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'IfxPy.cpython-310-x86_64-linux-gnu.so'
adding 'IfxPyDbi.py'
adding 'IfxPy-3.0.5.dist-info/LICENSE.txt'
adding 'IfxPy-3.0.5.dist-info/METADATA'
adding 'IfxPy-3.0.5.dist-info/WHEEL'
adding 'IfxPy-3.0.5.dist-info/top_level.txt'
adding 'IfxPy-3.0.5.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
informix@lxhost:~/OpenInformix/IfxPy/IfxPy$

Install the wheel dist:

informix@lxhost:~/OpenInformix/IfxPy/IfxPy$ python3 -m pip install ./dist/IfxPy-3.0.5-cp310-cp310-manylinux1_x86_64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./dist/IfxPy-3.0.5-cp310-cp310-manylinux1_x86_64.whl
WARNING: Error parsing dependencies of distro-info: Invalid version: '0.23ubuntu1'
WARNING: Error parsing dependencies of python-debian: Invalid version: '0.1.36ubuntu1'
Installing collected packages: IfxPy
Successfully installed IfxPy-3.0.5
informix@lxhost:~/OpenInformix/IfxPy/IfxPy$ 

And finllay, test it:

informix@lxhost:~/OpenInformix/IfxPy/IfxPy$ cd /tmp
informix@lxhost:/tmp$ cat test.py
import IfxPy

ConStr="Driver={IBM INFORMIX ODBC DRIVER};SERVER=ol_informix1410_4;DATABASE=sysmaster;host=127.0.0.1;service=15977;protocol=onsoctcp"

conn=IfxPy.connect(ConStr,"informix","mypassw")
if conn:
      stmt = IfxPy.exec_immediate(conn, "SELECT tabname FROM systables")
      res = IfxPy.fetch_tuple(stmt)
      rows = res[0]
      print (rows)

informix@lxhost:/tmp$ python3 test.py
systables
informix@lxhost:/tmp$ 

Uninstall:

informix@lxhost:/tmp$ python3 -m pip uninstall IfxPy
Found existing installation: IfxPy 3.0.5
Uninstalling IfxPy-3.0.5:
  Would remove:
    /home/informix/.local/lib/python3.10/site-packages/IfxPy-3.0.5.dist-info/*
    /home/informix/.local/lib/python3.10/site-packages/IfxPy.cpython-310-x86_64-linux-gnu.so
    /home/informix/.local/lib/python3.10/site-packages/IfxPyDbi.py
Proceed (Y/n)? y
  Successfully uninstalled IfxPy-3.0.5
informix@lxhost:/tmp$
informix@lxhost:/tmp$ python3 t.py
Traceback (most recent call last):
  File "/tmp/t.py", line 1, in <module>
    import IfxPy
ModuleNotFoundError: No module named 'IfxPy'
informix@lxhost:/tmp$