Bitcoin Forum
June 14, 2025, 08:25:07 AM *
News: Pizza day contest voting
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Armory dev branches errors with Python >3.9  (Read 72 times)
Aethereal (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 14


View Profile
February 26, 2025, 04:30:34 PM
 #1

Hello goatpig,
I am trying to build Armory on "Garuda", an arch-based rolling release that is enough up-to-date to use (at the time of my writing) Python 3.13.2
I successfully managed to compile "cappnp" branch on my machine, but I encountered some issues running it, even in --offline mode.
The errors I encountered are very similar to those shown in the logs of user miklerokamm in https://bitcointalk.org/index.php?topic=5521112.0
Digging into it, I noticed that since Python 3.10, there isn't anymore an automatic type cast, so most QT calls like setMinimumWidth, setMinimumHeight, setMinimumSize and potentially some others need an explicit int() around the argument, i.e.
self.editPasswd1.setMinimumWidth(MIN_PASSWD_WIDTH(self)) must become self.editPasswd1.setMinimumWidth(int(MIN_PASSWD_WIDTH(self))) to work
I assume you are using a Python version <3.10 where types were still automatically cast and didn't noticed the problem.
I manually changed some occurrences and become able to get to the main window. Actually I was even able to start the wizard for a new wallet, but encountered an error ('WalletBackupFrame' object has noattribute 'wlt') tryng to print a paper backup, I am not sure if you already fixed this in some other branch
This change should still be compatible with older python3 releases, and I hope you are able to implement it directly on the repository.
I'm quite interested in being able to compile a working version as I can't use anymore the old version that was available on AUR (can't install the python2 environment since some packages were discontinued) so let me know if I can be of any help
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3934
Merit: 1385

Armory Developer


View Profile
February 27, 2025, 08:35:06 AM
 #2

1. You should try the current bleeding edge branch: https://github.com/goatpig/BitcoinArmory/tree/loading_wallets
A lot easier for me to help you there, also a much better base if you want to PR fixes.

2. There are "up to date" build instructions for linux: https://github.com/goatpig/BitcoinArmory/blob/loading_wallets/build_instructions/linux/linux.md
My system runs py3.13.2, for which pycapnp fails to build, so I use a venv with py3.12.8 to run Armory

3. I'm not sure what you mean by the type cast. I have not run any of this on python <3.10, I don't think I've run into the issue you mention ever. Also what version of qt are you using? ArmoryQt uses qtpy now, so it can run against pyqt/pysides somewhat seamlessly. I do my development vs pysides6.

Aethereal (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 14


View Profile
February 27, 2025, 11:09:58 AM
Merited by BitMaxz (1)
 #3

Hello, and thank you for your prompt answer.

Answering your points:

1 - I have just tried building against the loading_wallets branch, and encountered the same issue (more on that later)

2 - I am building following the instructions you linked (these seems to be the same I found when working on the capnp branch), even if I had to explicit the paths for libbtc and libwebsockets in configure (I followed the suggested dir structure including build subdirs where indicated).

3 - My issue is that most QT calls give errors about the arguments being of "float" type when they expects "int" and looking around I found that before python 3.10 there was an automatic conversion of type deprecated in 3.10 and later, so I wrongfully assumed you were using an old version of python where this still happened automatically. I confirm I have the python-qtpy and python-pyqt5 packages installed and I also tried installing pysides6 but things didn't changed.

This is the errors if gives me on first run:

Code:
╭─lab@AI in repo: BitcoinArmory on  loading_wallets via △ v3.31.6 via  v3.13.2 took 0s
╰─λ python ArmoryQt.py --offline
********************************************************************************
Loading Armory Engine:
Armory Version:       0.96.99
Armory Build:         None
PyBtcWallet  Version: 1.99
Detected Operating system: Linux
OS Variant            : ('Garuda Linux', 'Soaring', 'BirdOfPrey')
User home-directory   : /home/lab
Satoshi BTC directory : /home/lab/.bitcoin
Armory home dir       : /home/lab/.armory/
ArmoryDB directory     : /home/lab/.armory/databases
Armory settings file  : /home/lab/.armory/ArmorySettings.txt
Armory log file       : /home/lab/.armory/armorylog.txt
Do wallet checking    : True
/home/lab/BitcoinArmory/qtdialogs/DlgRestore.py:106: SyntaxWarning: invalid escape sequence '\ '
inpMask = '<AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA!'
/home/lab/BitcoinArmory/qtdialogs/DlgRestore.py:1050: SyntaxWarning: invalid escape sequence '\ '
inpMask = '<AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA!'
/home/lab/BitcoinArmory/qtdialogs/DlgRestore.py:1053: SyntaxWarning: invalid escape sequence '\ '
inpMaskID = '<HHHH\ HHHH\ HHHH\ HHHH!'
/home/lab/BitcoinArmory/qtdialogs/DlgRestore.py:1237: SyntaxWarning: invalid escape sequence '\ '
inpMask = '<AAAA\ AAAA\ AAAA\ AAAA\ AA!'
/home/lab/BitcoinArmory/qtdialogs/DlgRestore.py:1247: SyntaxWarning: invalid escape sequence '\ '
inpMask = '<AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA\ AAAA\ AAAA\ AAAA\ \ AAAA!'
(ERROR) Settings.py:203 - Unsupported language  specified. Defaulting to English (en)
(ERROR) Traceback (most recent call last):
File "/home/lab/BitcoinArmory/ArmoryQt.py", line 5265, in <module>
armoryMainWindow = ArmoryMainWindow(splashScreen=SPLASH)
File "/home/lab/BitcoinArmory/ArmoryQt.py", line 356, in __init__
initialColResize(self.walletsView, [20, 0.15, 0.30, 0.2, 0.20])
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lab/BitcoinArmory/qtdialogs/qtdefines.py", line 208, in initialColResize
tblViewObj.horizontalHeader().resizeSection(c, pct*szRemain)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: resizeSection(self, logicalIndex: int, size: int): argument 2 has unexpected type 'float'

Traceback (most recent call last):
File "/home/lab/BitcoinArmory/ArmoryQt.py", line 5265, in <module>
armoryMainWindow = ArmoryMainWindow(splashScreen=SPLASH)
File "/home/lab/BitcoinArmory/ArmoryQt.py", line 356, in __init__
initialColResize(self.walletsView, [20, 0.15, 0.30, 0.2, 0.20])
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lab/BitcoinArmory/qtdialogs/qtdefines.py", line 208, in initialColResize
tblViewObj.horizontalHeader().resizeSection(c, pct*szRemain)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: resizeSection(self, logicalIndex: int, size: int): argument 2 has unexpected type 'float'
Please call QDesktopServices::unsetUrlHandler() before destroying a registered URL handler object.
Support for destroying a registered URL handler object is deprecated, and will be removed in Qt 6.6.
Please call QDesktopServices::unsetUrlHandler() before destroying a registered URL handler object.
Support for destroying a registered URL handler object is deprecated, and will be removed in Qt 6.6.


If I change
tblViewObj.horizontalHeader().resizeSection(c, pct*szRemain)
to
tblViewObj.horizontalHeader().resizeSection(c, int(pct*szRemain))
I can progress further, and doing the same for a couple of similar errors thrown, I get to the main program window.

I don't know if in your environment there's something that forces the casting of types, apparently there isn't on mine (and on miklerokamm's as he had the same issues showing on his logs).

For further information, I  installed the following packages not included in the default distro install to be able to successfully compile (might be useful for other people trying it):

capnproto
python-pycapnp
python-distro
python-cffi
python-setuptools
python-qtpy
python-lmdb

Thanks for your attention and keep up the good work!
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3934
Merit: 1385

Armory Developer


View Profile
February 27, 2025, 04:11:06 PM
Merited by BitMaxz (1)
 #4

This is super weird. Looking at the pyside6 documentation, resizeSection only accepts int, so casting down to int is correct, but this code is almost 10y old and has never failed, be it in py2 or py3, across windows, mac and linux. I don't quite understand why it would start failing now. I'm going to assume it has something to do with your system locale? That's the only thing I can think of.

There are only 2 instances of resizeSection in the source, so I've added the int cast and it seems to work just fine.

Quote
capnproto
python-pycapnp
python-distro
python-cffi
python-setuptools
python-qtpy
python-lmdb

Looks like you're installing these package as system libs via pacman. I'd suggest setting up a venv and installing python packages via pip, this lets you isolate the python environment from your actual system.

You do not need python-lmdb, it isn't used on the python side at all. I'm going to assume that helped you cause it most likely depends on system lmdb, which was installed along.

Aethereal (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 14


View Profile
February 28, 2025, 07:32:10 AM
Last edit: May 12, 2025, 09:10:48 AM by mprep
 #5

I agree it's a bit strange that it never come up until now. I am having the same float-to-int issue on
setMinimumWidth
setMinimumheight
setMinimumSize
that are present in various .py files. I'll have a look if I can find more

About installing packages system wide, it's not an issue as I'm currenly on a "lab" machine that I am using just to test Armory and see if it compiles for me. Once I am successfull, I'll do the same steps on the actual "production" machine where bitcoind is running (which use the same distro), but even this one will be dedicated to Armory so there will be no conflict with other programs.
I might later be interested in the best way to move the actual program out of the build environment (i.e. "install") so I can have a stable version in use while at the same moment being able to test further developments. But it's a bit early for that
Thank you



Hello @goatpig

I confirm I had to fix the int issue for the following calls:

setMinimumWidth
setMinimumHeight
setMinimumSize
setMaximumWidth
setMaximumHeight
setMaximumSize
QSize

This apparently was enough to let me run Armory and do some basic tests. Of course I am not sure there aren't other calls with similar problems, I'll know only once I'll be able to do a complete run of all the Armory features.
Let me know if you would like the files I updated so you can avoid hunting all the replaces yourself and can concentrate on the real work. Unfortunately I don't have a github account at the moment so I can't fork and create a pull request. Let me know what's the more useful way for you.

About the tests, I did some checks with wallets (that is, I understand, what you are working on) so it's possible you are already aware of the issues I encountered. I list them anyway for your convenience

First test, I tried to create a new wallet. I checked the flag for creating additional entropy, and got the dialog for the selection of the shuffled cards. All the boxes are black, so I just randomly clicked some until I got enough entropy and went on. I got this errror:

Code:
(ERROR) Traceback (most recent call last):
File "/home/lab/BitcoinArmory/ui/Wizards.py", line 133, in initializePage
self.createNewWalletFromWizard()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/lab/BitcoinArmory/ui/Wizards.py", line 185, in createNewWalletFromWizard
self.newWallet = PyBtcWallet().createNewWallet(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
passphrase=self.setPassphrasePage.pageFrame.getPassphrase(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
longLabel=self.walletCreationPage.pageFrame.getDescription(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
extraEntropy=entropy)
^^^^^^^^^^^^^^^^^^^^^
File "/home/lab/BitcoinArmory/armoryengine/PyBtcWallet.py", line 501, in createNewWallet
walletId = TheBridge.utils.createWallet(
addrPoolSize,
...<2 lines>...
shortLabel, longLabel,
extraEntropy)
File "/home/lab/BitcoinArmory/armoryengine/CppBridge.py", line 583, in createWallet
method.extraEntropy = extraEntropy
^^^^^^^^^^^^^^^^^^^
File "capnp/lib/capnp.pyx", line 1417, in capnp.lib.capnp._DynamicStructBuilder.__setattr__
File "capnp/lib/capnp.pyx", line 1410, in capnp.lib.capnp._DynamicStructBuilder._set
File "capnp/lib/capnp.pyx", line 794, in capnp.lib.capnp._setDynamicField
OverflowError: Python int too large to convert to C unsigned long

Additionally, I had the following error:

Code:
(ERROR) Traceback (most recent call last):
File "/home/lab/BitcoinArmory/ui/WalletFrames.py", line 1042, in clickedDoIt
isBackupCreated = OpenPaperBackupDialog('Single', self.parent(), self.main, self.wlt)
^^^^^^^^
AttributeError: 'WalletBackupFrame' object has no attribute 'wlt'

This might relatedto the previous though, since a wallet wan't actually created.

After that, I tried creating a wallet without asking for additional entropy, and was able to complete the task. Though, even if I asked to print a backup wallet, this didn't happened. Are there some dependencies needed for the print feature?
I'm on an offline session (and I don't have bitcoind running on this test machine) so I stopped here assuming the wallet is working.

Later, I tried restoring a paper backup I had. It's a 1.35c plain one. The restoring process was apparently successful, but even if I set a password on the walled when required (and confirmig it the third time) I got this error on console:

Code:
-WARN  - 2025-02-28 - 13:16:00.807: (../../cppForSwig/Wallets/WalletFileInterface.cpp:404) No control passphrase provided, wallet file will not be encrypted
-WARN  - 2025-02-28 - 13:16:16.237: (../../cppForSwig/Wallets/Accounts/AddressAccounts.cpp:349) empty inner account id, defaulting to outer account id
-ERROR - 2025-02-28 - 13:16:25.956: (../../cppForSwig/BridgeAPI/CppBridge.cpp:552) failed to register walletwith error: bdvPtr is not set
(ERROR) Traceback (most recent call last):
File "/home/lab/BitcoinArmory/ui/WalletFrames.py", line 1034, in clickedDoIt
unlockProgress = DlgProgress(self, self.main, HBar=1,
Title=self.tr("Unlocking Wallet"))
TypeError: 'module' object is not callable

The restored wallet was not shown in the wallets list at first, but when I closed and restarted Armory it was there, with "Encrypted" under the Security column.

Since the strange error, I wanted to try if the password I entered was correctly applied, so I opened the wallet properties page and clicked the "Click to Test" under "Unlock Time:" but I got the following error:

Code:
(ERROR) Traceback (most recent call last):
File "/home/lab/BitcoinArmory/qtdialogs/qtdefines.py", line 375, in mouseReleaseEvent
self.linkActivated.emit(ev)
~~~~~~~~~~~~~~~~~~~~~~~^^^^
TypeError: linkActivated(self, link: Optional[str]).emit(): argument 1 has unexpected type 'QMouseEvent'

That's all for now. Please let me know if you prefer a different way for reporting those issues.

Regards

[moderator's note: consecutive posts merged]
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3934
Merit: 1385

Armory Developer


View Profile
March 01, 2025, 10:00:07 AM
 #6

Quote
setMinimumWidth
setMinimumHeight
setMinimumSize
setMaximumWidth
setMaximumHeight
setMaximumSize
QSize

I've reviewed some of those call and there are many instances where they're already casted to int. I'll go over all this stuff over the weekend.

Quote
First test, I tried to create a new wallet. I checked the flag for creating additional entropy, and got the dialog for the selection of the shuffled cards. All the boxes are black, so I just randomly clicked some until I got enough entropy and went on. I got this errror:

Ah figures, I didn't try with extra entropy. Thanks for the report. I have yet to figure out why pictures aren't loading, will get around to it.

Quote
This might relatedto the previous though, since a wallet wan't actually created.

Haven't tried restore from the wizard, will check.

Quote
Later, I tried restoring a paper backup I had. It's a 1.35c plain one. The restoring process was apparently successful, but even if I set a password on the walled when required (and confirmig it the third time) I got this error on console:

Process is a bit wonky atm, it doesn't correctly detect whether it's offline or not. You have to explicitly feed it the --offline arg for now.

goatpig
Moderator
Legendary
*
Offline Offline

Activity: 3934
Merit: 1385

Armory Developer


View Profile
March 01, 2025, 02:58:23 PM
 #7

I've fixed a few things, it should run a bit smoother on your end. I've ran into a db issue along the way so i gotta focus that for now.

Quote
Since the strange error, I wanted to try if the password I entered was correctly applied, so I opened the wallet properties page and clicked the "Click to Test" under "Unlock Time:" but I got the following error:

This feature needs the full capnp and bridge support, will take a bit longer to address.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!