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

can't find libsecp256k1 library error #5606

Closed
bloctavius opened this issue Sep 2, 2019 · 17 comments · Fixed by #5947
Closed

can't find libsecp256k1 library error #5606

bloctavius opened this issue Sep 2, 2019 · 17 comments · Fixed by #5947

Comments

@bloctavius
Copy link

I ran all of the installation instructions in the development version's README, but I got this error.

I have bitcoin core v0.18 installed, so shouldn't I have libsecp256k1 installed?

(venv) zach@zach-desktop ~/electrum/electrum $ python3.6 run_electrum
Traceback (most recent call last):
  File "run_electrum", line 80, in <module>
    from electrum.logging import get_logger, configure_logging
  File "/home/zach/electrum/electrum/electrum/__init__.py", line 3, in <module>
    from .wallet import Wallet
  File "/home/zach/electrum/electrum/electrum/wallet.py", line 50, in <module>
    from .simple_config import get_config
  File "/home/zach/electrum/electrum/electrum/simple_config.py", line 13, in <module>
    from . import constants
  File "/home/zach/electrum/electrum/electrum/constants.py", line 30, in <module>
    from . import bitcoin
  File "/home/zach/electrum/electrum/electrum/bitcoin.py", line 34, in <module>
    from . import ecc
  File "/home/zach/electrum/electrum/electrum/ecc.py", line 45, in <module>
    do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1()
  File "/home/zach/electrum/electrum/electrum/ecc_fast.py", line 189, in do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1
    raise Exception('libsecp256k1 library not available. '
Exception: libsecp256k1 library not available. Verifying Lightning channels is too computationally expensive without libsecp256k1, aborting.
@willcl-ark
Copy link

I just encountered this also. To make it work, I had to install as per these instructions:

https://github.com/bitcoin-core/secp256k1#build-steps

@SomberNight
Copy link
Member

To make it work, I had to install as per these instructions:
https://github.com/bitcoin-core/secp256k1#build-steps

Also see https://github.com/spesmilo/electrum-docs/blob/master/libsecp256k1-linux.rst

Note: since merging the lightning branch, libsecp256k1 became a mandatory dependency (was optional before). The README was not updated since.

  • We need to decide whether we want libsecp256k1 to be mandatory; or test whether lightning is enabled and only hard fail then.
  • The README should be updated
  • tar.gz source distributables also need to be considered

@bloctavius
Copy link
Author

Thanks! It's working now.

@bloctavius
Copy link
Author

Oh, I should probably leave this open...

@SomberNight
Copy link
Member

SomberNight commented Sep 6, 2019

or test whether lightning is enabled and only hard fail then.

Did this in 251db63 for now
Longer term we could/should make libsecp256k1 mandatory. Still unsure... so keeping this issue open.

@ecdsa
Copy link
Member

ecdsa commented Sep 6, 2019

yes let's make it mandatory

@ecdsa
Copy link
Member

ecdsa commented Nov 23, 2019

it would be possible to list it as a python dependency, see https://github.com/electrumsv/electrumsv-secp256k1

@cool007zqw
Copy link

a lazy solution will be:

sudo apt install libsecp256k1-dev

@Tectract
Copy link

build / run fails because of this. It should be mentioned in the readme, or fixed internally to drag this lib in during install.

@Tectract
Copy link

Tectract commented Jan 12, 2020

since merging the lightning branch, libsecp256k1 became a mandatory dependency

Can we get the option to build without lightning? Have no interest in using that, ever.

@SomberNight
Copy link
Member

Can we get the option to build without lightning? Have no interest in using that, ever.

What exactly do you mean?
Lightning is not enabled by default.

The topic of this thread is whether to make libsecp256k1 a mandatory dependency.
Lightning is related in that libsecp256k1 is definitely needed if Lightning is enabled.
However, completely irrespective of that, there are reasons it might make sense to always require libsecp256k1.

@Tectract
Copy link

Hmmmmmmm, I'm running into an error here:

W | ecc_fast | failed to load libsecp256k1: OSError('libsecp256k1.so.0: cannot open shared object file: No such file or directory',)

I don't know how to bypass it. I have installed libsecp256k1 on my system. libsecp256k1.s.0 is in /usr/local/lib.

I can't run the new version from a clean build. What do I do?

@SomberNight
Copy link
Member

I don't know how to bypass it. I have installed libsecp256k1 on my system. libsecp256k1.s.0 is in /usr/local/lib.
I can't run the new version from a clean build. What do I do?

That's a warning, not an error.
Try symlinking it to /usr/lib, see:
https://github.com/spesmilo/electrum-docs/blob/master/libsecp256k1-linux.rst#symlink-so-file

@SomberNight
Copy link
Member

The package should run straight away out of the box without the need for any dependencies and there should be no exceptions to this.

@Thecreator1 If you use the AppImage (or Mac/Windows binaries), there are no dependencies. It is self-contained.

If you use the source tarball, it only contains python sources. It does not contain the non-pure-python dependencies.
If you want to run from source, as the README says, you have to provide the missing parts yourself. (mainly libsecp256k1, cryptography, and pyqt5)

@rwst
Copy link

rwst commented Feb 22, 2021

I still get the error. It seems that pip installs an empty package:

$ sudo python3 -m pip install libsecp256k1
Collecting libsecp256k1
  Downloading libsecp256k1-0.1.tar.gz (814 bytes)
Building wheels for collected packages: libsecp256k1
  Building wheel for libsecp256k1 (setup.py) ... done
  Created wheel for libsecp256k1: filename=libsecp256k1-0.1-py3-none-any.whl size=1286 sha256=e13542554348e8262dd3f627a07f0f773a856e4260065062c74921f3f14a9c7f
  Stored in directory: /root/.cache/pip/wheels/cd/6d/2c/584fd7c3ba781e91c1451aac7ed4cc3e5869481d696ebcdb09
Successfully built libsecp256k1
Installing collected packages: libsecp256k1
Successfully installed libsecp256k1-0.1

$ sudo pip3 show libsecp256k1 -f
Name: libsecp256k1
Version: 0.1
Summary: Alpha Version
Home-page: https://a.slashdotmedia.com/www/delivery/ck.php
Author: Slash Dot Media
Author-email: admin@slashdotmedia.com
License: MIT
Location: /usr/lib/python3.6/site-packages
Requires: 
Required-by: 
Files:
  libsecp256k1-0.1.dist-info/INSTALLER
  libsecp256k1-0.1.dist-info/METADATA
  libsecp256k1-0.1.dist-info/RECORD
  libsecp256k1-0.1.dist-info/REQUESTED
  libsecp256k1-0.1.dist-info/WHEEL
  libsecp256k1-0.1.dist-info/top_level.txt
  slashdot/__init__.py
  slashdot/__pycache__/__init__.cpython-36.pyc

Also, the given home page is empty. This makes electrum-4.0.9 unusable.

@Tectract
Copy link

build / run fails because of this

It's not a warning if you can't build because of it, it's an error. Users should never need access to /usr/lib, so it should look in /usr/local/lib for any libs it needs for a normal user install.

@SomberNight
Copy link
Member

@rwst see README

libsecp256k1 is not a pip package, it is a .so library

@Tectract

It's not a warning if you can't build because of it, it's an error

It used to be a warning when it was not a required dependency; it is an error since it became required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants