spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.41k stars 3.08k forks source link

Ledger Library version incompatible #8388

Closed jlopp closed 1 year ago

jlopp commented 1 year ago

I'm trying to run Electrum 4.2.2 from source on an Ubuntu machine.

$ ./run_electrum 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
  0.91 | E | plugins.ledger.ledger | error importing ledger plugin deps
Traceback (most recent call last):
  File "electrum/electrum/plugins/ledger/ledger.py", line 40, in <module>
    import hid
ModuleNotFoundError: No module named 'hid'
  0.91 | W | plugins.ledger.qt.Plugin | Library version for 'ledger' is incompatible.
Installed: 0.2.1, Needed: 0.1.1 <= x < inf

Not sure what's wrong, as it seems like I should meet the requirements.

SomberNight commented 1 year ago

how did you install the ledger-related deps, and where did you find the instructions you used?

try pip installing hidapi. Also, https://github.com/spesmilo/electrum/blob/847b3e919326244cef601a1bf948cfcf2b5148d5/contrib/requirements/requirements-hw.txt#L15-L18

That version of ledger-bitcoin might be too new, not sure atm.

I'm trying to run Electrum 4.2.2 from source

I guess you mean 4.4.2?

jlopp commented 1 year ago

Yeah, Electrum 4.4.2. I had installed ledger_bitcoin manually but have uninstalled it and ran

pip3 install contrib/requirements/requirements-hw.txt

Now when I ./run_electrum I get:

$ ./run_electrum 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
  0.85 | E | plugins.ledger.ledger | error importing ledger plugin deps
Traceback (most recent call last):
  File "electrum/electrum/plugins/ledger/ledger.py", line 40, in <module>
    import hid
  File "~/.local/lib/python3.10/site-packages/hid/__init__.py", line 30, in <module>
    raise ImportError(error)
ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll
  0.86 | W | plugins.ledger.qt.Plugin | Library version for 'ledger' is incompatible.
Installed: 0.1.2, Needed: 0.1.1 <= x < inf
SomberNight commented 1 year ago

The readme mentions this doc: https://github.com/spesmilo/electrum/blame/847b3e919326244cef601a1bf948cfcf2b5148d5/README.md#L57-L58

Although atm it is a bit outdated for ledger in particular. I'll try to update it. Anyway, you should be okay re step 2 in that doc, but see steps 1 and 3, i.e. $ sudo apt-get install libusb-1.0-0-dev libudev-dev and setting up udev rules.

jlopp commented 1 year ago

I was able to fix it via:

pip3 uninstall -r contrib/requirements/requirements-hw.txt
pip3 install -r contrib/requirements/requirements-hw.txt
jlopp commented 1 year ago

I'd just note that the format of the error that was output is really really hard to interpret; it seems backwards

Installed: 0.2.1, Needed: 0.1.1 <= x < inf

Reads to me as "version must be greater than or equal to 0.1.1 and less than infinity"

SomberNight commented 1 year ago

Reads to me as "version must be greater than or equal to 0.1.1 and less than infinity"

Yes, that is exactly what it says though. The runtime checks atm only specify those contraints Your original issue was about not having hidapi installed I think, you can see that in the traceback logged just above the inequality. The error manifested when trying to import ledger-bitcoin, hence it was guessed that your version is not compatible -- but turns out it might have just been that a dependency was missing. 0.2.1 being too new I was just guessing based on the requirements file I referenced above.

Anyway, I will test that newer version tomorrow for compatibility.

SomberNight commented 1 year ago

done in https://github.com/spesmilo/electrum/commit/302049919996575ee46a86a4220aab44137cf0ec and https://github.com/spesmilo/electrum-docs/commit/20d5797a87a174684fced624fb8f429ce78e2012