Fix various imptp test failures with YDBPython wrapper random choice on Ubuntu 24.04
Background
-
Various subtests that use
com/imptp.csh
failed on an Ubuntu 24.04 system when the random wrapper was chosen to beYDBPython
. -
For example, the below was the diff for the
mupjnl/gtm5007
subtest failure.27a28,30 > ##TEST_PATH##/mupjnl_0/gtm5007/endtp.out > $ZSTATUS="150372994,wait+9^job,%YDB-E-GVUNDEF, Global variable undefined: ^%jobwait(0,""njobs"")"
Issue
-
Line 63 below shows the primary failure.
$ cat imptp.out 57 # Inheriting imptpflavor from env var ydb_imptp_flavor 58 imptpflavor: 3 59 Cloning into '##TEST_PATH##/mupjnl_0/gtm5007/python'... 60 Traceback (most recent call last): 61 File "##TEST_PATH##/mupjnl_0/gtm5007/python/setup.py", line 14, in <module> 62 from setuptools import setup, Extension, find_packages 63 ModuleNotFoundError: No module named 'setuptools' 64 Traceback (most recent call last): 65 File "##TEST_PATH##/mupjnl_0/gtm5007/imptp.py", line 20, in <module> 66 import yottadb 67 ModuleNotFoundError: No module named 'yottadb'
-
On the Ubuntu 24.04 system, the below version of python was installed.
$ python3 --version Python 3.12.3
-
After some research, found the following python 3.12 release note that captured the cause.
https://docs.python.org/3/whatsnew/3.12.html
gh-95299: Do not pre-install
setuptools
in virtual environments created withvenv
. This means thatdistutils
,setuptools
,pkg_resources
, andeasy_install
will no longer available by default; to access these runpip install setuptools
in the activated virtual environment.
Fix
-
The fix is simple and is to run
pip install setuptools
(just like the above release note says) after having activated the virtual environment (which is already done bysource .venv/bin/activate.csh
incom/setuppyenv.csh
). -
Although this step is needed only for python 3.12 onwards, it works fine even for older python versions and so it is done always as it is cleaner this way.