Xpra: Ticket #2777: 4.0.2 ImportError: DLL load failed while importing _gi: The specified module could not be found

"Xpra-Python3-x86_64_4.0.2-r26463\xpra_cmd" attach ssh://user@ip/20 --ssh="plink -ssh -agent" --modal-windows=no --title="@title@ on @hostname@/@server-display@" --opengl=no --bandwidth-limit=6Mbps
xpra main error:
Traceback (most recent call last):
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 125, in main
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 365, in run_mode
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 489, in do_run_mode
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 1507, in run_client
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 1627, in get_client_app
  File "E:\Xpra\tags\v4.0.x\src/xpra/scripts/main.py", line 1839, in make_client
  File "E:\Xpra\tags\v4.0.x\src/xpra/client/gtk3/__init__.py", line 6, in <module>
  File "C:/msys64/mingw64/lib/python3.8/site-packages/gi/__init__.py", line 42, in <module>
ImportError: DLL load failed while importing _gi: The specified module could not be found.

Mon, 25 May 2020 08:02:11 GMT - stdedos: description changed

Tue, 26 May 2020 03:00:52 GMT - totaamwin32: owner, status changed

So, MSYS2 is gradually moving away from python2, the problem with gobject is this:

$ pacman -Su
:: Starting core system upgrade...
 there is nothing to do
:: Starting full system upgrade...
:: Replace mingw-w64-x86_64-pygobject-devel with mingw64/mingw-w64-x86_64-python-gobject? [Y/n] y
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing mingw-w64-x86_64-pygobject-devel breaks dependency 'mingw-w64-x86_64-pygobject-devel=3.34.0' required by mingw-w64-x86_64-python2-gobject

So I've been updating this build system using --ignore="*gobject*". The problem is that libffi-6.dll is now gone, and so the older gi bindings don't work anymore.

Here's the upstream bug: Import Error with PyGObject.

Tue, 26 May 2020 04:01:20 GMT - totaamwin32: status changed; resolution set

Fixing things:

pacman -R mingw-w64-x86_64-python2-gobject
pacman -Su
Packages (5) mingw-w64-x86_64-gobject-introspection-runtime-1.64.1-2  mingw-w64-x86_64-pygobject-devel-3.34.0-3 [removal]
             mingw-w64-x86_64-pygobject2-devel-2.28.7-3  mingw-w64-x86_64-python-gobject-3.36.1-1  mingw-w64-x86_64-python2-gobject2-2.28.7-3

I've backed up mingw-w64-x86_64-pygobject-devel in case we need it again. I remember lazka saying something about the new python3 headers still being usable with python2 (can't find the message), but for how long?

Now the python3 builds work, but the python2 builds still don't:

$ python2 -c "import gi"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\msys64\mingw64\lib\python2.7\site-packages/gi/__init__.py", line 42, in <module>
ImportError: cannot import name _gi

Trying to rebuild python2-pygobject fails:

cd mingw-w64-python2-pygobject/
$ makepkg -sCLf
==> Making package: mingw-w64-python2-pygobject 3.34.0-4 (Tue, May 26, 2020  5:24:31 AM)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found pygobject-3.34.0.tar.xz
==> Validating source files with sha256sums...
    pygobject-3.34.0.tar.xz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting pygobject-3.34.0.tar.xz with bsdtar
==> Starting prepare()...
tee: standard input: Invalid argument
==> ERROR: A failure occurred in prepare().

So I ended up rebuilding it by hand... Worked OK on the 32-bit build system!?

Works OK now. (tested 4.0.2 and 3.0.10 - both with python2 and python3)

Sat, 23 Jan 2021 06:00:32 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2777