related: 5e0df77df6
kivy 2.1 seemingly became more sensitive to threading issues.
This used to work on kivy 2.0 and older, but 2.1 is complaining.
```
E | lnworker.LNWallet.[default_wallet] | Exception in pay_invoice: TypeError('Cannot create graphics instruction outside the main Kivy thread')
Traceback (most recent call last):
File "...\electrum\util.py", line 1184, in wrapper
return await func(*args, **kwargs)
File "...\electrum\lnworker.py", line 1178, in pay_invoice
util.trigger_callback('payment_succeeded', self.wallet, key)
File "...\electrum\util.py", line 1633, in trigger_callback
callback(*args)
File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
self.show_info(_('Payment succeeded') + '\n\n' + description)
File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
self.show_info_bubble(text=error, icon=icon, width=width,
File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
info_bubble = self.info_bubble = Factory.InfoBubble()
File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
self._arrow_layout = BoxLayout()
File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
E | gui.kivy.uix.dialogs.crash_reporter.ExceptionHook | exception caught by crash reporter
Traceback (most recent call last):
File "...\electrum\gui\kivy\uix\screens.py", line 419, in pay_thread
fut.result()
File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
return self.__get_result()
File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
raise self._exception
File "...\electrum\util.py", line 1184, in wrapper
return await func(*args, **kwargs)
File "...\electrum\lnworker.py", line 1178, in pay_invoice
util.trigger_callback('payment_succeeded', self.wallet, key)
File "...\electrum\util.py", line 1633, in trigger_callback
callback(*args)
File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
self.show_info(_('Payment succeeded') + '\n\n' + description)
File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
self.show_info_bubble(text=error, icon=icon, width=width,
File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
info_bubble = self.info_bubble = Factory.InfoBubble()
File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
self._arrow_layout = BoxLayout()
File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "...\electrum\util.py", line 1128, in run_with_except_hook
run_original(*args2, **kwargs2)
File "...\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "...\electrum\gui\kivy\uix\screens.py", line 421, in pay_thread
self.app.show_error(repr(e))
File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
self.show_info_bubble(text=error, icon=icon, width=width,
File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
info_bubble = self.info_bubble = Factory.InfoBubble()
File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
self._arrow_layout = BoxLayout()
File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
Exception in thread Thread-2 (pay_thread):
Traceback (most recent call last):
File "...\electrum\gui\kivy\uix\screens.py", line 419, in pay_thread
fut.result()
File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
return self.__get_result()
File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
raise self._exception
File "...\electrum\util.py", line 1184, in wrapper
return await func(*args, **kwargs)
File "...\electrum\lnworker.py", line 1178, in pay_invoice
util.trigger_callback('payment_succeeded', self.wallet, key)
File "...\electrum\util.py", line 1633, in trigger_callback
callback(*args)
File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
self.show_info(_('Payment succeeded') + '\n\n' + description)
File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
self.show_info_bubble(text=error, icon=icon, width=width,
File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
info_bubble = self.info_bubble = Factory.InfoBubble()
File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
self._arrow_layout = BoxLayout()
File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "...\electrum\util.py", line 1128, in run_with_except_hook
run_original(*args2, **kwargs2)
File "...\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "...\electrum\gui\kivy\uix\screens.py", line 421, in pay_thread
self.app.show_error(repr(e))
File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
self.show_info_bubble(text=error, icon=icon, width=width,
File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
info_bubble = self.info_bubble = Factory.InfoBubble()
File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
self._arrow_layout = BoxLayout()
File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
super(BoxLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "...\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "...\electrum\util.py", line 1130, in run_with_except_hook
sys.excepthook(*sys.exc_info())
File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 188, in <lambda>
sys.excepthook = lambda exctype, value, tb: self.handle_exception(value)
File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 199, in handle_exception
e = CrashReporter(self.main_window, *exc_info)
File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 100, in __init__
Factory.Popup.__init__(self)
File "...\Python310\site-packages\kivy\uix\modalview.py", line 195, in __init__
super(ModalView, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\anchorlayout.py", line 68, in __init__
super(AnchorLayout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "...\Python310\site-packages\kivy\uix\widget.py", line 361, in __init__
self.canvas = Canvas(opacity=self.opacity)
File "kivy\graphics\instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
File "kivy\graphics\instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
File "kivy\graphics\instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
```
Electrum - Lightweight Bitcoin client
Licence: MIT Licence
Author: Thomas Voegtlin
Language: Python (>= 3.8)
Homepage: https://electrum.org/
Getting started
(If you've come here looking to simply run Electrum, you may download it here.)
Electrum itself is pure Python, and so are most of the required dependencies, but not everything. The following sections describe how to run from source, but here is a TL;DR:
$ sudo apt-get install libsecp256k1-0
$ python3 -m pip install --user ".[gui,crypto]"
Not pure-python dependencies
If you want to use the Qt interface, install the Qt dependencies:
$ sudo apt-get install python3-pyqt5
For elliptic curve operations, libsecp256k1 is a required dependency:
$ sudo apt-get install libsecp256k1-0
Alternatively, when running from a cloned repository, a script is provided to build libsecp256k1 yourself:
$ sudo apt-get install automake libtool
$ ./contrib/make_libsecp256k1.sh
Due to the need for fast symmetric ciphers, cryptography is required. Install from your package manager (or from pip):
$ sudo apt-get install python3-cryptography
If you would like hardware wallet support, see this.
Running from tar.gz
If you downloaded the official package (tar.gz), you can run Electrum from its root directory without installing it on your system; all the pure python dependencies are included in the 'packages' directory. To run Electrum from its root directory, just do:
$ ./run_electrum
You can also install Electrum on your system, by running this command:
$ sudo apt-get install python3-setuptools python3-pip
$ python3 -m pip install --user .
This will download and install the Python dependencies used by
Electrum instead of using the 'packages' directory.
It will also place an executable named electrum in ~/.local/bin,
so make sure that is on your PATH variable.
Development version (git clone)
(For OS-specific instructions, see here for Windows, and for macOS)
Check out the code from GitHub:
$ git clone https://github.com/spesmilo/electrum.git
$ cd electrum
$ git submodule update --init
Run install (this should install dependencies):
$ python3 -m pip install --user -e .
Create translations (optional):
$ sudo apt-get install python-requests gettext
$ ./contrib/pull_locale
Finally, to start Electrum:
$ ./run_electrum
Run tests
Run unit tests with pytest:
$ pytest electrum/tests -v
To run a single file, specify it directly like this:
$ pytest electrum/tests/test_bitcoin.py -v
Creating Binaries
Contributing
Any help testing the software, reporting or fixing bugs, reviewing pull requests and recent changes, writing tests, or helping with outstanding issues is very welcome. Implementing new features, or improving/refactoring the codebase, is of course also welcome, but to avoid wasted effort, especially for larger changes, we encourage discussing these on the issue tracker or IRC first.
Besides GitHub,
most communication about Electrum development happens on IRC, in the
#electrum channel on Libera Chat. The easiest way to participate on IRC is
with the web client, web.libera.chat.