Hi Mathieu, [...] > I think the issue here lies in the sitecustomize.py file introduced with > cb72f9a773e0931ee3758c851d96007ded034e4c. > > python_root = os.path.realpath(sys.executable).split('/bin/')[0] > > > When using the Python C library, sys.executable is not the expected > python binary but the test binary. > > So when we try to find the associated libraries in the Python search > path, this way: > > index = sys_path_absolute.index(python_site) > sys.path = sys.path[:index] + matching_sites + sys.path[index:] > > > we get: > > ValueError: '/home/mathieu/glade-3.38.2/build/lib/python3.9/site-packages' is not in list > > > Running the test with the PYTHONPATH set to: > > PYTHONPATH=/home/mathieu/glade-3.38.2/build/lib/python3.9/site-packages:$PYTHONPATH > > is a way to work around this issue. > > The fix here would be to replace sys.executable in the sitecustomize.py > with something more adequate, but I have no idea what could it be. From the doc [0], sys.prefix seems to be more correct. This had been suggested by Hartmut some time ago and I had this patch ready recently. Perhaps it already addresses the issue at hand? You'll find it attached. It hasn't gotten much testing yet. [0] https://docs.python.org/3/library/sys.html#sys.prefix