IBM / ibmi-bob

A build system for creating IBM i-native objects using GNU Make.
https://ibm.github.io/ibmi-bob
Apache License 2.0
46 stars 20 forks source link

ModuleNotFoundError: No module named 'ibm_db_dbi' #304

Closed arco400 closed 4 months ago

arco400 commented 5 months ago

I'm messing around trying to understand ibmi-bob and sourceorbit and get it to work. Some time ago I had bob kind of working, but had to delay the further discovery due to time constraints. Now I wanted to restart that, and I updated bob to latest version 2.4.26 and sourceorbit to 0.10.1. When I try to build the bob-recursive-example I get the error No module named 'ibm_db_dbi'. As I understand this is a missing python module, but I have no experience with that, and don't want to end up in an installation mess.

The more detailed error message:

bash-5.2$ cd bob-recursive-example bash-5.2$ export lib1=BOBTESTA bash-5.2$ makei build Traceback (most recent call last): File "/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py", line 15, in from makei.cvtsrcpf import CvtSrcPf File "/QOpenSys/pkgs/lib/bob/src/makei/cvtsrcpf.py", line 7, in from makei.ibm_job import IBMJob File "/QOpenSys/pkgs/lib/bob/src/makei/ibm_job.py", line 10, in import ibm_db_dbi ModuleNotFoundError: No module named 'ibm_db_dbi'

My path is /QOpenSys/pkgs/bin:/QOpenSys/pkgs/lib/nodejs18/bin:/QOpenSys/pkgs/bin:/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin

arco400 commented 5 months ago

I have uninstalled version 2.4.26 and then installed back version 2.3.9. That version runs without problem. Updated again to 2.4.26, and the error is there again.

` -bash-5.2$ echo $PATH /QOpenSys/pkgs/bin:/QOpenSys/pkgs/lib/nodejs18/bin:/QOpenSys/pkgs/bin:/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin

-bash-5.2$ yum install bob-2.3.9-1 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package bob.ppc64 0:2.3.9-1 will be installed --> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository
Size

Installing: bob ppc64 2.3.9-1 ibmi-base 788 k

Transaction Summary

Install 1 Package

Total download size: 788 k Installed size: 788 k Is this ok [y/N]: y Downloading Packages: bob-2.3.9-1.ibmi7.3.ppc64.rpm | 788 kB 00:00:02
Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Installing : bob-2.3.9-1.ppc64 1/1

Installed: bob.ppc64 0:2.3.9-1

Complete!

-bash-5.2$ makei usage: makei [-h] [-v] command ...

optional arguments: -h, --help show this help message and exit -v, --version print version information and exit

These are common makei commands: command init set up a new or existing project info get information about the current project compile (c) compile a single file build (b) build the whole project cvtsrcpf convert source physical file members to ASCII IFS files

-bash-5.2$ yum install bob Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package bob.ppc64 0:2.3.9-1 will be updated ---> Package bob.ppc64 0:2.4.26-1 will be an update --> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size

Updating: bob ppc64 2.4.26-1 ibmi-base 3.1 M

Transaction Summary

Upgrade 1 Package

Total size: 3.1 M Is this ok [y/N]: y Downloading Packages: Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Updating : bob-2.4.26-1.ppc64 1/2 Cleanup : bob-2.3.9-1.ppc64 2/2

Updated: bob.ppc64 0:2.4.26-1

Complete!

-bash-5.2$ makei Traceback (most recent call last): File "/QOpenSys/pkgs/lib/bob/src/makei/cli/makei_entry.py", line 15, in from makei.cvtsrcpf import CvtSrcPf File "/QOpenSys/pkgs/lib/bob/src/makei/cvtsrcpf.py", line 7, in from makei.ibm_job import IBMJob File "/QOpenSys/pkgs/lib/bob/src/makei/ibm_job.py", line 10, in import ibm_db_dbi ModuleNotFoundError: No module named 'ibm_db_dbi' -bash-5.2$ `

edmundreinhardt commented 4 months ago

@ThePrez Jesse, does this mean we need to depend on ibm_db_dbi in the bob.spec?

edmundreinhardt commented 4 months ago

@arco400 Arco can you try

yum install python3-ibm_db  
edmundreinhardt commented 4 months ago

@ThePrez I see that we already require

Requires: python3 >= 3.6
Requires: python3-ibm_db >= 2.0.5.12

Is that sufficient? How is it possible that Arco is not finding the ibm_db_dbi module?

ThePrez commented 4 months ago

The python3 in their environment is likely a different version of python

The shebang line should be fixed to use the version depended on, like so:

#!/usr/bin/env python3.6
edmundreinhardt commented 4 months ago

So when the require line says

Requires: python3 >= 3.6

can I use the shebang you gave me. Will it still be OK if they install 3.8, what about 3.9 that seems to have a different db2 module?

arco400 commented 4 months ago

Do I have to try something @edmundreinhardt ?

The packages you mentioned are already on our system:

` Installed Packages Name : python3 Arch : ppc64 Version : 3.6.15 Release : 1 Size : 139 M Repo : installed From repo : ibmi-base Summary : Python 3 Programming Language URL : https://www.python.org License : Python-2.0 Description : Python is a programming language that lets you work more quickly : and integrate your systems more effectively. : : You can learn to use Python and see almost immediate gains in : productivity and lower maintenance costs.

Name : python3-ibm_db Arch : ppc64 Version : 2.0.5.12 Release : 0 Size : 674 k Repo : installed From repo : ibmi-base Summary : Python support for IBM Db2 URL : https://github.com/ibmdb/python-ibmdb License : Apache-2.0 Description : Python support for IBM Db2

`

arco400 commented 4 months ago

We do have python2 still installed on the system. Can that be a blocking reason?

` python2 | 2.7.15-1 | installed

python2-iniparse | 0.4-2 | @ibmi-base/$releasever

python2-pycurl | 7.43.0-4 | @ibmi-base

python2-rpm | 4.13.0.1-12 | installed

python2-urlgrabber | 3.10.2-0 | installed

`

arco400 commented 4 months ago

@edmundreinhardt I just noticed something else. I had also installed @worksofliam SourceOrbit, which required the install of nodejs18. And nodejs18 on its turn has a dependency on Python 3.9 which is now the current installed version on our system. Could that be the issue?

edmundreinhardt commented 4 months ago

@ThePrez would it help to standardize on Python 3.9?

edmundreinhardt commented 4 months ago

We do have python2 still installed on the system. Can that be a blocking reason?

` python2 | 2.7.15-1 | installed

python2-iniparse | 0.4-2 | @ibmi-base/$releasever

python2-pycurl | 7.43.0-4 | @ibmi-base

python2-rpm | 4.13.0.1-12 | installed

python2-urlgrabber | 3.10.2-0 | installed

`

I don't think this is an issue because you also have python 3.

edmundreinhardt commented 4 months ago

@arco400 Do you have yum list python39-ibm_db installed?

arco400 commented 4 months ago

@edmundreinhardt Ah definitely not, only python3-ibm_db is installed. I'll install that 39 version and test again.

edmundreinhardt commented 4 months ago

If that works, then I know how to solve this for the future.

arco400 commented 4 months ago

BOB Version 2.4.26-1 reinstalled after the python39-ibm_db package and that worked! Thanks @edmundreinhardt !