Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ModuleNotFoundError: No module named 'btchip'", however, it also won't let me install 'btchip' #9370

Open
gitaccount798 opened this issue Dec 17, 2024 · 6 comments
Milestone

Comments

@gitaccount798
Copy link

Environment: Ubuntu 24.04, Electrum 4.5.8

Full error message:


File "/home/computer/.local/lib/python3.12/site-packages/electrum/plugins/ledger/ledger.py", line 42, in <module>
    from btchip.btchipComm import HIDDongleHIDAPI
ModuleNotFoundError: No module named 'btchip'
  9.41 | W | plugins.ledger.qt.Plugin | Library version for 'ledger' is incompatible.
Installed: 0.3.0, Needed: 0.2.0 <= x < 0.4.0

It won't also let me install btchip:


python3 -m pip install btchip-python
Defaulting to user installation because normal site-packages is not writeable
Collecting btchip-python
  Using cached btchip-python-0.1.32.tar.gz (20 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in btchip-python setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have installed the following (as per https://github.com/spesmilo/electrum-docs/blob/master/hardware-linux.rst):

sudo apt-get install libusb-1.0-0-dev libudev-dev
python3 -m pip install hidapi ecdsa ledger-bitcoin  #(but it would not accept btchip-python)

apt show libudev-dev
Package: libudev-dev
Version: 255.4-1ubuntu8.4
Priority: optional
Section: admin
Source: systemd
Origin: Ubuntu
Maintainer: Ubuntu Developers [email protected]
Original-Maintainer: Debian systemd Maintainers [email protected]
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 197 kB
Depends: libudev1 (= 255.4-1ubuntu8.4)
Homepage: https://www.freedesktop.org/wiki/Software/systemd
Download-Size: 22.0 kB
APT-Manual-Installed: yes
APT-Sources: http://nz.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
Description: libudev development files
This library provides APIs to introspect and enumerate devices on the local
system.
.
This package contains the files needed for developing applications that
use libudev.

N: There is 1 additional record. Please use the '-a' switch to see it

apt show libusb-1.0-0-dev
Package: libusb-1.0-0-dev
Version: 2:1.0.27-1
Priority: optional
Section: libdevel
Source: libusb-1.0
Origin: Ubuntu
Maintainer: Ubuntu Developers [email protected]
Original-Maintainer: Aurelien Jarno [email protected]
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 328 kB
Depends: libusb-1.0-0 (= 2:1.0.27-1)
Recommends: libusb-1.0-doc
Homepage: http://www.libusb.info/
Download-Size: 77.7 kB
APT-Manual-Installed: yes
APT-Sources: http://nz.archive.ubuntu.com/ubuntu noble/main amd64 Packages
Description: userspace USB programming library development files
Library for programming USB applications without the knowledge
of Linux kernel internals.
.
This package contains what you need for compiling sources that
use this library in your own code.

pip show ecdsa
Name: ecdsa
Version: 0.19.0
Summary: ECDSA cryptographic signature library (pure python)
Home-page: http://github.com/tlsfuzzer/python-ecdsa
Author: Brian Warner
Author-email: [email protected]
License: MIT
Location: /home/computer/.local/lib/python3.12/site-packages
Requires: six
Required-by: trezor

pip show hidapi
Name: hidapi
Version: 0.14.0.post4
Summary: A Cython interface to the hidapi from https://github.com/libusb/hidapi
Home-page: https://github.com/trezor/cython-hidapi
Author: Pavol Rusnak
Author-email: [email protected]
License:
Location: /home/computer/.local/lib/python3.12/site-packages
Requires: setuptools
Required-by:

pip show ledger-bitcoin
Name: ledger_bitcoin
Version: 0.3.0
Summary: Client for Ledger Nano Bitcoin application
Home-page: https://github.com/LedgerHQ/app-bitcoin-new
Author: Ledger
Author-email: [email protected]
License:
Location: /home/computer/.local/lib/python3.12/site-packages
Requires: ledgercomm, packaging, typing-extensions
Required-by:

pip show setuptools
Name: setuptools
Version: 75.6.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page:
Author:
Author-email: Python Packaging Authority [email protected]
License:
Location: /home/computer/.local/lib/python3.12/site-packages
Requires:
Required-by: hidapi

@gitaccount798
Copy link
Author

gitaccount798 commented Dec 17, 2024

Similar issue: #6928 . Seems also somewhat related LedgerHQ/btchip-python#42

@gitaccount798
Copy link
Author

Related issue pypa/setuptools#3801 with same error message as this issue :

"error in btchip-python setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers."

in that case an upgrade of setuptools causing btchip to regress.

@gitaccount798
Copy link
Author

gitaccount798 commented Dec 23, 2024

I have tried using earlier versions of setuptools, earlier versions of python (3.10.xx as opposed the 3.12 that Ubuntu 24.04 comes with), but to no avail, and I am still unable to perform python3 -m pip install btchip-python and the error persists.

I have however been able to duplicate the this error with the suspected workflow on a different machine. I installed python3 -m pip install btchip-python with no issue a Ubuntu 22.04, then upgraded to Ubuntu 24.04, tried python3 -m pip install btchip-python again and then the error occurs:

"error in btchip-python setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers."

The Ubuntu 24.04 installation where I got the error, I also upgraded earlier this year from Ubuntu 22.04.

I have not tried yet to install python3 -m pip install btchip-python on a clean (not indirectly upgraded) Ubuntu 24.04 installation, but if that doesn't work I'll have to go back to Ubuntu 22.04, where I know it works.

@gitaccount798
Copy link
Author

Can confirm that also on a completely clean Ubuntu 24.04 installation python3 -m pip install btchip-python produces the same error. I will close the issue, but it essentially means I am unable to use a ledger with electrum on a Ubuntu 24.04 installation.

What I am not sure about is that https://github.com/LedgerHQ/btchip-python has been archived on Oct 16, 2024 and is read-only, yet electrum is still requiring the btchip-python library. I will investigate with ledger further.

@gitaccount798
Copy link
Author

gitaccount798 commented Dec 24, 2024

Decided to leave open for a bit longer in case there are some further thoughts/feedback on this. Not being able to use ledger on electrum in Ubuntu 24.04 is not ideal.

@bigspider
Copy link
Contributor

As it's noted here, ledger_bitcoin already ships with a copy of the btchip module (although it apparently doesn't support the old HW.1), so the dependency can probably be dropped with little loss by using that for the legacy protocol (which is only used in old app versions below 2.1.0).

So it might be a good time to pull the plug on HW.1! 🫡

@SomberNight SomberNight added this to the 4.6.0 milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants