bitcoin-core / HWI

Bitcoin Hardware Wallet Interface
MIT License
498 stars 198 forks source link

Ubuntu 18.04 enumerate empty array #149

Closed Sjors closed 4 years ago

Sjors commented 5 years ago

Everything seems to work with the binary, but when I install from source using Poetry then enumerate returns an empty array. That suggest a silent failure somewhere. Any guesses?

$ poetry install
Creating virtualenv hwi-py3.6 in /home/dev/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 14 installs, 0 updates, 0 removals

  - Installing altgraph (0.16.1)
  - Installing future (0.17.1)
  - Installing macholib (1.11)
  - Installing pbkdf2 (1.3)
  - Installing pefile (2018.8.8)
  - Installing typing (3.6.6)
  - Installing ecdsa (0.13)
  - Installing hidapi (0.7.99.post21)
  - Installing libusb1 (1.7)
  - Installing mnemonic (0.18)
  - Installing pyaes (1.6.1)
  - Installing pyinstaller (3.4)
  - Installing python-bitcoinrpc (1.0)
  - Installing typing-extensions (3.7.2)
  - Installing hwi (1.0.0)
A setup.py file already exists. Using it.

Back in #74 the empty array was a result of a missing ecda dependency, but that seems included above.

instagibbs commented 5 years ago

turning this into a feature request that will help you figure it out maybe: Have failure to find_device in the try block could print something in a verbose mode. Same with enumerate loop, add a verbose logging setting during ImportError. We intentionally silence those because often they're just noise to the user.

Sjors commented 5 years ago

I think we should silence errors more narrowly, if feasible. Especially now that we include all device drivers anyway.

instagibbs commented 5 years ago

It was very noisy before, ie "Hey you don't have Trezor drivers~!!" when someone doesn't even have a Trezor(we shouldn't be having users install stuff they don't need). That's why I suggested a verbose mode to start.

Sjors commented 5 years ago

In this case it was missing the mnemonic module. That suggests a borked virtualenv.

So one class of errors we should definitely not catch is ModuleNotFoundError.

achow101 commented 5 years ago

Try doing poetry shell after poetry install. That will drop you into a shell with the correct virtualenv.

Sjors commented 5 years ago

That did the trick! Would be a useful instruction to add.

The other approach that worked for me was to install PyEnv and then pip3 install --user hidapi ecdsa pyaes typing_extensions mnemonic libusb1.

Having both PyEnv and Poetry on the same user creates a world of pain by the way.

jonasnick commented 5 years ago

I had to use the poetry shell trick as well otherwise I just got an empty list.

PatrickZGW commented 5 years ago

Same for me on Ubuntu 18.04 and Trezor One. Using the binary or using @achow101's trick works.

alecalve commented 5 years ago

Same issue here with Ubuntu 18.04 and a Ledger Nano S. Cloning then running ./hwi.py enumerate from the normal, already installed, python3 interpreter results in an empty list. Running it from a virtualenv with the packages listed by @Sjors works fine.

instagibbs commented 4 years ago

this still an issue?