[GNC-dev] Windows Build VM

john jralls at ceridwen.us
Sat Nov 18 14:32:21 EST 2023


> On Nov 17, 2023, at 17:23, Manfred Usselmann <manfred at usselmann.de> wrote:
> 
> Am 2023-11-17 05:58, schrieb john:
> 
>> 
>> 
>>> On Nov 16, 2023, at 14:25, Manfred Usselmann <manfred at usselmann.de> wrote:
>>> 
>>> Am 2023-11-16 18:41, schrieb john:
>>> 
>>> 
>>> 
>>> On Nov 16, 2023, at 03:50, Manfred Usselmann <manfred at usselmann.de> wrote:
>>> 
>>> Hi,
>>> 
>>> Am 2023-11-07 04:53, schrieb john:
>>> 
>>> 
>>> 
>>> On Nov 6, 2023, at 16:12, Manfred Usselmann <manfred at usselmann.de> wrote:
>>> 
>>> Hi John,
>>> 
>>> Am 2023-11-06 19:31, schrieb john:
>>> On Nov 6, 2023, at 05:11, Manfred Usselmann <manfred at usselmann.de> wrote:
>>> Hi,
>>> Am 2023-10-01 17:47, schrieb john:
>>> On Oct 1, 2023, at 06:00, Derek Atkins <derek at ihtfp.com> wrote:
>>> On Sun, October 1, 2023 12:00 am, flywire wrote:
>>> https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106619.html
>>> John wrote:
>>> we don't have a Windows CI action, the nightly builds are done with the
>>> https://github.com/gnucash/GnuCash-on-windows powershell scripts on a
>>> Windows VM in Derek's basement.
>>> The nightly builds are those on https://code.gnucash.org/builds/win32/stable/, right?
>>> Would it be possible to additonally provide a version there which includes the Python bindings?
>>> No, there's no way to make that work with an installed package.
>>> Since there already exists a working build environment, I would hope that it's not too much work?
>>> That depends on what you want to use for your Python. If you can use the MSYS2 environment from Powershell (some MSYS2 things work directly in Powershell, others need a Bash shell) then you can simply add -DWITH_PYTHON=ON to the CMakeArgs in jhbuild and build it. Don't run the installer, just add c:\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages to PYTHONPATH and run your scripts.
>>>  
>>> After starting from scratch I'm now able to run a successful build including the Python bindings.
>>>  
>>> After adding
>>> C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages
>>> to PYTHONPATH my script now starts and does no longer complain about the gnucash imports.
>>>  
>>> But the script aborts and it looks like Python does not find _gnucash_core_c.dll in this folder. :-(
>>>  
>>> I also added C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash to the Windows Path, but this does not help.
>>> Traceback (most recent call last):
>>>   File "C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", line 14, in swig_import_helper
>>>     return importlib.import_module(mname)
>>>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>   File "C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
>>>     return _bootstrap._gcd_import(name[level:], package, level)
>>>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>   File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
>>>   File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
>>>   File "<frozen importlib._bootstrap>", line 1318, in _find_and_load_unlocked
>>> ModuleNotFoundError: No module named 'gnucash._gnucash_core_c'
>>> 
>>> During handling of the above exception, another exception occurred:
>>> 
>>> Traceback (most recent call last):
>>>   File "C:\Users\mu\Documents\Nextcloud_Manfred\Manfred Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py", line 18, in <module>
>>>     from gnucash import Session, Account, Transaction, Split, GncNumeric, GUID, GUIDString, gnucash_core_c
>>>   File "C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\__init__.py", line 6, in <module>
>>>     from gnucash.gnucash_core import *
>>>   File "C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core.py", line 36, in <module>
>>>     from gnucash import gnucash_core_c
>>>   File "C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", line 17, in <module>
>>>     _gnucash_core_c = swig_import_helper()
>>>                       ^^^^^^^^^^^^^^^^^^^^
>>>   File "C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", line 16, in swig_import_helper
>>>     return importlib.import_module('_gnucash_core_c')
>>>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>   File "C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
>>>     return _bootstrap._gcd_import(name[level:], package, level)
>>>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> ModuleNotFoundError: No module named '_gnucash_core_c'
>>> 
>>> Process finished with exit code 1
>>> 
>>> Do you also have C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib and C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\gnucash in %PATH% ? 
>>>  
>>> I've added them now, but it makes no difference.
>>>  
>>>  
>>> Does C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\_gnucash_core_c.dll exist? 
>>>  
>>> BTW the bindings also need _sw_app_utils.dll and _sw_core_utils.dll in that directory along with _gnucash_core_c.dll and various python files.
>>>  
>>> Yes, they are there the following files:
>>> 
>>> __init__.py
>>> _gnucash_core_c.dll
>>> _sw_app_utils.dll
>>> _sw_core_utils.dll
>>> app_utils.py
>>> deprecation.py
>>> function_class.py
>>> gnucash_business.py
>>> gnucash_core.py
>>> gnucash_core_c.py
>>> 
>>> folder __pycache__
>>> 
>>>  
>>> Some of these files are mentioned in the error messages above.
>>> 
>>> Could it be a problem for  importlib.import_module() that GnuCash is build with Python 3.11 32-bit and I have Python 3.11 64-bit installed?
>>> 
>> 
>> Ah, missed that. It's not even 3.11:
>>  
>>>>   File "C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
>>>> 
>>  
>> That wouldn't work even if it was a 32-bit build because it's a different version of python and the cpython folks don't maintain ABI across versions. For best results use C:\Users\mu\Entwicklung\GnuCash\gcdev64\msys2\mingw32\bin\python3, making sure to set up the environment accordingly. The easiest way to do that is to use the Mingw32 shell from Start>MSYS2.
>>  
>> Regards,
>> John Ralls
>>  
> This error occurs even then: 
> 
> 
> Traceback (most recent call last):
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py", line 14, in swig_import_helper
>     return importlib.import_module(mname)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/msys2/mingw32/lib/python3.11/importlib/__init__.py", line 126, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
> ModuleNotFoundError: No module named 'gnucash._gnucash_core_c'
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "C:\Users\mu\Documents\Nextcloud_Manfred\Manfred Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py", line 17, in <module>
>     from gnucash import Session, Account, Transaction, Split, GncNumeric, GUID, GUIDString, gnucash_core_c
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/__init__.py", line 6, in <module>
>     from gnucash.gnucash_core import *
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core.py", line 36, in <module>
>     from gnucash import gnucash_core_c
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py", line 17, in <module>
>     _gnucash_core_c = swig_import_helper()
>                       ^^^^^^^^^^^^^^^^^^^^
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py", line 16, in swig_import_he
> lper
>     return importlib.import_module('_gnucash_core_c')
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "C:/Users/mu/Entwicklung/GnuCash/gcdev64/msys2/mingw32/lib/python3.11/importlib/__init__.py", line 126, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ModuleNotFoundError: No module named '_gnucash_core_c'
> 
> 
> 
> What else can I try?
> 
What's the shebang in C:\Users\mu\Documents\Nextcloud_Manfred\Manfred Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py? What do `which python` and `which python3` display? (Should be the same thing.)

Regards,
John Ralls



More information about the gnucash-devel mailing list