Giter Club home page Giter Club logo

secp256k1-py's Introduction

secp256k1-py Build Status Coverage Status

Python FFI bindings for libsecp256k1 (an experimental and optimized C library for EC operations on curve secp256k1).

Installation

pip install secp256k1

Precompiled binary packages (wheels)

Precompiled binary wheels is available for Python 2.7, 3.3, 3.4, and 3.5 on Linux. To take advantage of those you need to use pip >= 8.1.0.

In case you don't want to use the binary packages you can prevent pip from using them with the following command:

pip install --no-binary secp256k1

Installation with compilation

If you either can't or don't want to use the binary package options described above read on to learn what is needed to install the source pacakge.

There are two modes of installation depending on whether you already have libsecp256k1 installed on your system:

Using a system installed libsecp256k1

If the library is already installed it should usually be automatically detected and used. However if libsecp256k1 is installed in a non standard location you can use the environment variables INCLUDE_DIR and LIB_DIR to point the way:

INCLUDE_DIR=/opt/somewhere/include LIB_DIR=/opt/somewhere/lib pip install --no-binary secp256k1
Using the bundled libsecp256k1

If on the other hand you don't have libsecp256k1 installed on your system, a bundled version will be built and used. In this case only the recovery module will be enabled since it's the only one not currently considered as "experimental" by the library authors. This can be overridden by setting the SECP_BUNDLED_EXPERIMENTAL environment variable:

SECP_BUNDLED_EXPERIMENTAL=1 pip install --no-binary secp256k1

For the bundled version to compile successfully you need to have a C compiler as well as the development headers for libffi and libgmp installed.

On Debian / Ubuntu for example the necessary packages are:

  • build-essential
  • automake
  • pkg-config
  • libtool
  • libffi-dev
  • libgmp-dev

On OS X the necessary homebrew packages are:

  • automake
  • pkg-config
  • libtool
  • libffi
  • gmp

Command line usage

Generate a private key and show the corresponding public key
$ python -m secp256k1 privkey -p

a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e
Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3
Sign a message
$ python -m secp256k1 sign \
	-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \
	-m hello

3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369
Check signature
$ python -m secp256k1 checksig \
	-p 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3 \
	-m hello \
	-s 3045022100a71d86190354d64e5b3eb2bd656313422cdf7def69bf3669cdbfd09a9162c96e0220713b81f3440bff0b639d2f29b2c48494b812fa89b754b7b6cdc9eaa8027cf369

True
Generate a signature that allows recovering the public key
$ python -m secp256k1 signrec \
	-k a1455c78a922c52f391c5784f8ca1457367fa57f9d7a74fdab7d2c90ca05c02e \
	-m hello

515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 1
Recover public key
$ python -m secp256k1 recpub \
	-s 515fe95d0780b11633f3352deb064f1517d58f295a99131e9389da8bfacd64422513d0cd4e18a58d9f4873b592afe54cf63e8f294351d1e612c8a297b5255079 \
	-i 1 \
	-m hello

Public key: 02477ce3b986ab14d123d6c4167b085f4d08c1569963a0201b2ffc7d9d6086d2f3

It is easier to get started with command line, but it is more common to use this as a library. For that, check the next sections.

API

class secp256k1.PrivateKey(privkey, raw, flags)

The PrivateKey class loads or creates a private key by obtaining 32 bytes from urandom and operates over it.

Instantiation parameters
  • privkey=None - generate a new private key if None, otherwise load a private key.
  • raw=True - if True, it is assumed that privkey is just a sequence of bytes, otherwise it is assumed that it is in the DER format. This is not used when privkey is not specified.
  • flags=secp256k1.ALL_FLAGS - see Constants.
Methods and instance attributes
  • pubkey: an instance of secp256k1.PublicKey.

  • private_key: raw bytes for the private key.

  • set_raw_privkey(privkey)
    update the private_key for this instance with the bytes specified by privkey. If privkey is invalid, an Exception is raised. The pubkey is also updated based on the new private key.

  • serialize() -> bytes
    convert the raw bytes present in private key to a hexadecimal string.

  • deserialize(privkey_ser) -> bytes
    convert from a hexadecimal string to raw bytes and update the pubkey and private_key for this instance.

  • tweak_add(scalar) -> bytes
    tweak the current private key by adding a 32 byte scalar to it and return a new raw private key composed of 32 bytes.

  • tweak_mul(scalar) -> bytes
    tweak the current private key by multiplying it by a 32 byte scalar and return a new raw private key composed of 32 bytes.

  • ecdsa_sign(msg, raw=False, digest=hashlib.sha256) -> internal object
    by default, create an ECDSA-SHA256 signature from the bytes in msg. If raw is True, then the digest function is not applied over msg, otherwise the digest must produce 256 bits or an Exception will be raised.

    The returned object is a structure from the C lib. If you want to store it (on a disk or similar), use ecdsa_serialize and later on use ecdsa_deserialize when loading.

  • ecdsa_sign_recoverable(msg, raw=False, digest=hashlib.sha256) -> internal object
    create a recoverable ECDSA signature. See ecdsa_sign for parameters description.

NOTE: ecdsa_sign_recoverable can only be used if the secp256k1 C library is compiled with support for it. If there is no support, an Exception will be raised when calling it.

  • schnorr_sign(msg, raw=False, digest=hashlib.sha256) -> bytes
    create a signature using a custom EC-Schnorr-SHA256 construction. It produces non-malleable 64-byte signatures which support public key recovery batch validation, and multiparty signing. msg, raw, and digest are used as described in ecdsa_sign.

  • schnorr_generate_nonce_pair(msg, raw=False, digest=hashlib.sha256) -> (internal object, internal object)
    generate a nonce pair deterministically for use with schnorr_partial_sign. msg, raw, and digest are used as described in ecdsa_sign.

  • schnorr_partial_sign(msg, privnonce, pubnonce_others, raw=False, digest=hashlib.sha256) -> bytes
    produce a partial Schnorr signature, which can be combined using schnorr_partial_combine to end up with a full signature that is verifiable using PublicKey.schnorr_verify. privnonce is the second item in the tuple returned by schnorr_generate_nonce_pair, pubnonce_others represent the combined public nonces excluding the one associated to this privnonce. msg, raw, and digest are used as described in ecdsa_sign.

    To combine pubnonces, use PublicKey.combine.

    Do not pass the pubnonce produced for the respective privnonce; combine the pubnonces from other signers and pass that instead.

class secp256k1.PublicKey(pubkey, raw, flags)

The PublicKey class loads an existing public key and operates over it.

Instantiation parameters
  • pubkey=None - do not load a public key if None, otherwise do.
  • raw=False - if False, it is assumed that pubkey has gone through PublicKey.deserialize already, otherwise it must be specified as bytes.
  • flags=secp256k1.FLAG_VERIFY - see Constants.
Methods and instance attributes
  • public_key: an internal object representing the public key.

  • serialize(compressed=True) -> bytes
    convert the public_key to bytes. If compressed is True, 33 bytes will be produced, otherwise 65 will be.

  • deserialize(pubkey_ser) -> internal object
    convert the bytes resulting from a previous serialize call back to an internal object and update the public_key for this instance. The length of pubkey_ser determines if it was serialized with compressed=True or not. This will raise an Exception if the size is invalid or if the key is invalid.

  • combine(pubkeys) -> internal object
    combine multiple public keys (those returned from PublicKey.deserialize) and return a public key (which can be serialized as any other regular public key). The public_key for this instance is updated to use the resulting combined key. If it is not possible the combine the keys, an Exception is raised.

  • tweak_add(scalar) -> internal object
    tweak the current public key by adding a 32 byte scalar times the generator to it and return a new PublicKey instance.

  • tweak_mul(scalar) -> internal object
    tweak the current public key by multiplying it by a 32 byte scalar and return a new PublicKey instance.

  • ecdsa_verify(msg, raw_sig, raw=False, digest=hashlib.sha256) -> bool
    verify an ECDSA signature and return True if the signature is correct, False otherwise. raw_sig is expected to be an object returned from ecdsa_sign (or if it was serialized using ecdsa_serialize, then first run it through ecdsa_deserialize). msg, raw, and digest are used as described in ecdsa_sign.

  • schnorr_verify(msg, schnorr_sig, raw=False, digest=hashlib.sha256) -> bool
    verify a Schnorr signature and return True if the signature is correct, False otherwise. schnorr_sig is expected to be the result from either schnorr_partial_combine or schnorr_sign. msg, raw, and digest are used as described in ecdsa_sign.

  • ecdh(scalar) -> bytes
    compute an EC Diffie-Hellman secret in constant time. The instance public_key is used as the public point, and the scalar specified must be composed of 32 bytes. It outputs 32 bytes representing the ECDH secret computed. If the scalar is invalid, an Exception is raised.

NOTE: ecdh can only be used if the secp256k1 C library is compiled with support for it. If there is no support, an Exception will be raised when calling it.

class secp256k1.ECDSA

The ECDSA class is intended to be used as a mix in. Its methods can be accessed from any secp256k1.PrivateKey or secp256k1.PublicKey instances.

Methods
  • ecdsa_serialize(raw_sig) -> bytes
    convert the result from ecdsa_sign to DER.

  • ecdsa_deserialie(ser_sig) -> internal object
    convert DER bytes to an internal object.

  • ecdsa_serialize_compact(raw_sig) -> bytes
    convert the result from ecdsa_sign to a compact serialization of 64 bytes.

  • ecdsa_deserialize_compact(ser_sig) -> internal object
    convert a compact serialization of 64 bytes to an internal object.

  • ecdsa_signature_normalize(raw_sig, check_only=False) -> (bool, internal object | None)
    check and optionally convert a signature to a normalized lower-S form. If check_only is True then the normalized signature is not returned.

    This function always return a tuple containing a boolean (True if not previously normalized or False if signature was already normalized), and the normalized signature. When check_only is True, the normalized signature returned is always None.

  • ecdsa_recover(msg, recover_sig, raw=False, digest=hashlib.sha256) -> internal object
    recover an ECDSA public key from a signature generated by ecdsa_sign_recoverable. recover_sig is expected to be an object returned from ecdsa_sign_recoverable (or if it was serialized using ecdsa_recoverable_serialize, then first run it through ecdsa_recoverable_deserialize). msg, raw, and digest are used as described in ecdsa_sign.

    In order to call ecdsa_recover from a PublicKey instance, it's necessary to create the instance by settings flags to ALL_FLAGS: secp256k1.PublicKey(..., flags=secp256k1.ALL_FLAGS).

  • ecdsa_recoverable_serialize(recover_sig) -> (bytes, int)
    convert the result from ecdsa_sign_recoverable to a tuple composed of 65 bytesand an integer denominated as recovery id.

  • ecdsa_recoverable_deserialize(ser_sig, rec_id)-> internal object
    convert the result from ecdsa_recoverable_serialize back to an internal object that can be used by ecdsa_recover.

  • ecdsa_recoverable_convert(recover_sig) -> internal object
    convert a recoverable signature to a normal signature, i.e. one that can be used by ecdsa_serialize and related methods.

NOTE: ecdsa_recover* can only be used if the secp256k1 C library is compiled with support for it. If there is no support, an Exception will be raised when calling any of them.

class secp256k1.Schnorr

The Schnorr class is intended to be used as a mix in. Its methods can be accessed from any secp256k1.PrivateKey or secp256k1.PublicKey instances.

Methods
  • schnorr_recover(msg, schnorr_sig, raw=False, digest=hashlib.sha256) -> internal object
    recover and return a public key from a Schnorr signature. schnorr_sig is expected to be the result from schnorr_partial_combine or schnorr_sign. msg, raw, and digest are used as described in ecdsa_sign.

  • schnorr_partial_combine(schnorr_sigs) -> bytes
    combine multiple Schnorr partial signatures. raw_sigs is expected to be a list (or similar iterable) of signatures resulting from PrivateKey.schnorr_partial_sign. If the signatures cannot be combined, an Exception is raised.

NOTE: schnorr_* can only be used if the secp256k1 C library is compiled with support for it. If there is no support, an Exception will be raised when calling any of them.

Constants

secp256k1.FLAG_SIGN
secp256k1.FLAG_VERIFY
secp256k1.ALL_FLAGS

ALL_FLAGS combines FLAG_SIGN and FLAG_VERIFY using bitwise OR.

These flags are used during context creation (undocumented here) and affect which parts of the context are initialized in the C library. In these bindings, some calls are disabled depending on the active flags but this should not be noticeable unless you are manually specifying flags.

Example

from secp256k1 import PrivateKey, PublicKey

privkey = PrivateKey()
privkey_der = privkey.serialize()
assert privkey.deserialize(privkey_der) == privkey.private_key

sig = privkey.ecdsa_sign(b'hello')
verified = privkey.pubkey.ecdsa_verify(b'hello', sig)
assert verified

sig_der = privkey.ecdsa_serialize(sig)
sig2 = privkey.ecdsa_deserialize(sig_der)
vrf2 = privkey.pubkey.ecdsa_verify(b'hello', sig2)
assert vrf2

pubkey = privkey.pubkey
pub = pubkey.serialize()

pubkey2 = PublicKey(pub, raw=True)
assert pubkey2.serialize() == pub
assert pubkey2.ecdsa_verify(b'hello', sig)
from secp256k1 import PrivateKey

key = '31a84594060e103f5a63eb742bd46cf5f5900d8406e2726dedfc61c7cf43ebad'
msg = '9e5755ec2f328cc8635a55415d0e9a09c2b6f2c9b0343c945fbbfe08247a4cbe'
sig = '30440220132382ca59240c2e14ee7ff61d90fc63276325f4cbe8169fc53ade4a407c2fc802204d86fbe3bde6975dd5a91fdc95ad6544dcdf0dab206f02224ce7e2b151bd82ab'

privkey = PrivateKey(bytes(bytearray.fromhex(key)), raw=True)
sig_check = privkey.ecdsa_sign(bytes(bytearray.fromhex(msg)), raw=True)
sig_ser = privkey.ecdsa_serialize(sig_check)

assert sig_ser == bytes(bytearray.fromhex(sig))
from secp256k1 import PrivateKey

key = '7ccca75d019dbae79ac4266501578684ee64eeb3c9212105f7a3bdc0ddb0f27e'
pub_compressed = '03e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e9'
pub_uncompressed = '04e9a06e539d6bf5cf1ca5c41b59121fa3df07a338322405a312c67b6349a707e94c181c5fe89306493dd5677143a329065606740ee58b873e01642228a09ecf9d'

privkey = PrivateKey(bytes(bytearray.fromhex(key)))
pubkey_ser = privkey.pubkey.serialize()
pubkey_ser_uncompressed = privkey.pubkey.serialize(compressed=False)

assert pubkey_ser == bytes(bytearray.fromhex(pub_compressed))
assert pubkey_ser_uncompressed == bytes(bytearray.fromhex(pub_uncompressed))

Technical details about the bundled libsecp256k1

The bundling of libsecp256k1 is handled by the various setup.py build phases:

  • During 'sdist': If the directory libsecp256k1 doesn't exist in the source directory it is downloaded from the location specified by the LIB_TARBALL_URL constant in setup.py and extracted into a directory called libsecp256k1

    To upgrade to a newer version of the bundled libsecp256k1 source simply delete the libsecp256k1 directory and update the LIB_TARBALL_URL to point to a newer commit.

  • During 'install': If an existing (system) installation of libsecp256k1 is found (either in the default library locations or in the location pointed to by the environment variable LIB_DIR) it is used as before.

    Due to the way the way cffi modules are implemented it is necessary to perform this detection in the cffi build module _cffi_build/build.py as well as in setup.py. For that reason some utility functions have been moved into a setup_support.py module which is imported from both.

    If however no existing installation can be found the bundled source code is used to build a library locally that will be statically linked into the CFFI extension.

    By default only the recovery module will be enabled in this bundled version as it is the only one not considered to be 'experimental' by the libsecp256k1 authors. It is possible to override this and enable all modules by setting the environment variable SECP_BUNDLED_EXPERIMENTAL.

secp256k1-py's People

Contributors

adamisz avatar ludbb avatar ulope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

secp256k1-py's Issues

Cannot install on Fedora 26/27 using Python 3.6

Run docker build -t foo . for this Dockerfile:

FROM fedora:27
RUN  dnf install -y gcc automake autoconf pkg-config libtool python3-devel \
    libffi-devel openssl-devel redhat-rpm-config 
RUN pip3 install --user secp256k1
CMD echo "Hi!"

Result:

    /tmp/pip-build-p8qbm3sp/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
    /tmp/pip-build-p8qbm3sp/secp256k1/libsecp256k1/src/tests.c: In function ‘test_ecdsa_der_parse’:
    /tmp/pip-build-p8qbm3sp/secp256k1/libsecp256k1/src/tests.c:3702:52: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’
             valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256;
                                                        ^~
    make: *** [Makefile:1048: src/tests-tests.o] Error 1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-p8qbm3sp/secp256k1/setup.py", line 295, in <module>
        "Topic :: Security :: Cryptography"
      File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib64/python3.6/distutils/command/install.py", line 555, in run
        self.run_command('build')
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-p8qbm3sp/secp256k1/setup.py", line 217, in run
        subprocess.check_call(["make"], cwd=build_temp)
      File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.

Wheels?

I'm not au fait with the details, but I was under the impression that there would be wheels here after the PR #12 ?

Error when loading TypeError: 'ellipsis' object is not iterable

Wanting to use the ECDH to encrypt/decrypt... getting this in the log:

File "/project/hashblock-exchange/modules/state.py", line 19, in <module>
hashblock-rest        |     from ecies import aes_encrypt, aes_decrypt
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/ecies/__init__.py", line 2, in <module>
hashblock-rest        |     from ecies.utils import generate_key, hex2prv, hex2pub, derive, aes_encrypt, aes_decrypt
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/ecies/utils.py", line 8, in <module>
hashblock-rest        |     from eth_keys import keys
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/eth_keys/__init__.py", line 15, in <module>
hashblock-rest        |     from .main import (  # noqa: F401
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/eth_keys/main.py", line 3, in <module>
hashblock-rest        |     from eth_keys.datatypes import (
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/eth_keys/datatypes.py", line 8, in <module>
hashblock-rest        |     from eth_utils import (
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/eth_utils/__init__.py", line 24, in <module>
hashblock-rest        |     from .applicators import (  # noqa: F401
hashblock-rest        |   File "/usr/local/lib/python3.5/dist-packages/eth_utils/applicators.py", line 43, in <module>
hashblock-rest        |     def combine_argument_formatters(*formatters: List[Callable[..., Any]]) -> Formatters:
hashblock-rest        |   File "/usr/lib/python3.5/typing.py", line 1025, in __getitem__
hashblock-rest        |     tvars = _type_vars(params)
hashblock-rest        |   File "/usr/lib/python3.5/typing.py", line 284, in _type_vars
hashblock-rest        |     _get_type_vars(types, tvars)
hashblock-rest        |   File "/usr/lib/python3.5/typing.py", line 279, in _get_type_vars
hashblock-rest        |     t._get_type_vars(tvars)
hashblock-rest        |   File "/usr/lib/python3.5/typing.py", line 786, in _get_type_vars
hashblock-rest        |     _get_type_vars(self.__args__, tvars)
hashblock-rest        |   File "/usr/lib/python3.5/typing.py", line 277, in _get_type_vars
hashblock-rest        |     for t in types:
hashblock-rest        | TypeError: 'ellipsis' object is not iterable

No module named \'secp256k1._libsecp256k1\

I am currently trying to run this module on a Debian server running node.js, which then spins up a python3 process in order to run various tasks. Whenever I use this module, I get the error:
No module named \'secp256k1._libsecp256k1\

I have installed it in experimental mode
I have the latest C compiler
I have installed the relevant packages:
build-essential
automake
pkg-config
libtool
libffi-dev
libgmp-dev

The error comes from the line 5 in init.py:
from ._libsecp256k1 import ffi, lib

When trying to run pip3 install --no-binary libsecp256k1 I get:

`Usage:
  pip install [options] <requirement specifier> ...
  pip install [options] -r <requirements file> ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --no-binary`
staging >     ----- Python Traceback -----                                                                                                                   
staging >     File "ecdsa_imp/lib/python3.6/site-packages/ecdsa.py", line 6, in <module> 
staging >       from sign import sign                                                                                                                         
staging >     File "/var/www/ico_test/source/ecdsa_imp/lib/python3.6/site-packages/sign.py", line 8, in <module>                                           
staging >       from secp256k1 import PrivateKey                                                                                                              
staging >     File "/var/www/ico_test/source/ecdsa_imp/lib/python3.6/site-packages/secp256k1/__init__.py", line 5, in <module>                             
staging >       from ._libsecp256k1 import ffi, lib                                                                                                            
staging >   traceback: 'Traceback (most recent call last):\n  File "ecdsa_imp/lib/python3.6/site-packages/ecdsa.py", line 6, in <module>\n    from sign import sign\n  File "/var/www/ico_test/source/ecdsa_imp/lib/python3.6/site-packages/sign.py", line 8, in <module>\n    from secp256k1 import PrivateKey\n  File "/var/www/ico_test/source/ecdsa_imp/lib/python3.6/site-packages/secp256k1/__init__.py", line 5, in <module>\n    from ._libsecp256k1 import ffi, lib\nImportError : No module named \'secp256k1._libsecp256k1\'\n',                                                                                                                  
staging >   executable: '/usr/bin/python3',

Is there anything else that I am missing?

ValueError: invalid literal for int() with base 10: 'post20170921'

OS: Arch Linux
Python: Python 3.6.3 (Anaconda)

Collecting secp256k1 (from ethereum<2.0.0,>=1.6.1->eth-testrpc>=1.3.0->populus)
  Using cached secp256k1-0.13.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-7b11re3w/secp256k1/setup.py", line 41, in <module>
        if [int(i) for i in setuptools_version.split('.')] < [3, 3]:
      File "/tmp/pip-build-7b11re3w/secp256k1/setup.py", line 41, in <listcomp>
        if [int(i) for i in setuptools_version.split('.')] < [3, 3]:
    ValueError: invalid literal for int() with base 10: 'post20170921'

Cannot install in Mac Catalina

hi al.
I am trying to install this lib but got failed on Mac Catalina
this is error log i got. Can you take a look.

2019-12-28T15:35:26,718 Collecting secp256k1
2019-12-28T15:35:26,718   Created temporary directory: /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-unpack-8b97l6sg
2019-12-28T15:35:26,782   Using cached https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz
2019-12-28T15:35:26,842   Added secp256k1 from https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz#sha256=a3b43e02d321c09eafa769a6fc2c156f555cab3a7db62175ef2fd21e16cdf20c to build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:26,847     Running setup.py (path:/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1/setup.py) egg_info for package secp256k1
2019-12-28T15:35:26,847     Running command python setup.py egg_info
2019-12-28T15:35:27,126     0.29.2
2019-12-28T15:35:27,147     WARNING: The wheel package is not available.
2019-12-28T15:35:28,680       ERROR: Command errored out with exit status 1:
2019-12-28T15:35:28,681        command: /Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/setup.py'"'"'; __file__='"'"'/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-cwga1twi
2019-12-28T15:35:28,681            cwd: /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-wheel-y2eg77wj/pytest-runner/
2019-12-28T15:35:28,681       Complete output (7 lines):
2019-12-28T15:35:28,681       WARNING: The wheel package is not available.
2019-12-28T15:35:28,681       usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
2019-12-28T15:35:28,681          or: setup.py --help [cmd1 cmd2 ...]
2019-12-28T15:35:28,681          or: setup.py --help-commands
2019-12-28T15:35:28,681          or: setup.py cmd --help

2019-12-28T15:35:28,681       error: invalid command 'bdist_wheel'
2019-12-28T15:35:28,681       ----------------------------------------
2019-12-28T15:35:28,681       ERROR: Failed building wheel for pytest-runner
2019-12-28T15:35:28,903     ERROR: Failed to build one or more wheels
2019-12-28T15:35:28,948     Traceback (most recent call last):
2019-12-28T15:35:28,948       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
2019-12-28T15:35:28,949         subprocess.check_call(cmd)
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 311, in check_call
2019-12-28T15:35:28,949         raise CalledProcessError(retcode, cmd)
2019-12-28T15:35:28,949     subprocess.CalledProcessError: Command '['/Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/tmpkysqesjx', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.

2019-12-28T15:35:28,949     During handling of the above exception, another exception occurred:

2019-12-28T15:35:28,949     Traceback (most recent call last):
2019-12-28T15:35:28,949       File "<string>", line 1, in <module>
2019-12-28T15:35:28,949       File "/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1/setup.py", line 295, in <module>
2019-12-28T15:35:28,949         "Topic :: Security :: Cryptography"
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
2019-12-28T15:35:28,949         _install_setup_requires(attrs)
2019-12-28T15:35:28,949       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
2019-12-28T15:35:28,949         dist.fetch_build_eggs(dist.setup_requires)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
2019-12-28T15:35:28,950         replace_conflicting=True,
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve
2019-12-28T15:35:28,950         replace_conflicting=replace_conflicting
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match
2019-12-28T15:35:28,950         return self.obtain(req, installer)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain
2019-12-28T15:35:28,950         return installer(requirement)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
2019-12-28T15:35:28,950         return fetch_build_egg(self, req)
2019-12-28T15:35:28,950       File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
2019-12-28T15:35:28,950         raise DistutilsError(str(e))
2019-12-28T15:35:28,950     distutils.errors.DistutilsError: Command '['/Users/antory/.pyenv/versions/3.6.9/envs/p36env/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/tmpkysqesjx', '--quiet', 'pytest-runner==2.6.2']' returned non-zero exit status 1.
2019-12-28T15:35:28,969 Cleaning up...
2019-12-28T15:35:28,970   Removing source in /private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-install-asprpmg1/secp256k1
2019-12-28T15:35:28,983 Removed secp256k1 from https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz#sha256=a3b43e02d321c09eafa769a6fc2c156f555cab3a7db62175ef2fd21e16cdf20c from build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:28,983 Removed build tracker '/private/var/folders/md/xlm2b58s5wv6sm85x0rdz_w80000gn/T/pip-req-tracker-andiakrd'
2019-12-28T15:35:28,983 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2019-12-28T15:35:28,983 Exception information:
2019-12-28T15:35:28,983 Traceback (most recent call last):
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
2019-12-28T15:35:28,983     status = self.run(options, args)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 382, in run
2019-12-28T15:35:28,983     resolver.resolve(requirement_set)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
2019-12-28T15:35:28,983     self._resolve_one(requirement_set, req)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
2019-12-28T15:35:28,983     abstract_dist = self._get_abstract_dist_for(req_to_install)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
2019-12-28T15:35:28,983     req, self.session, self.finder, self.require_hashes
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 224, in prepare_linked_requirement
2019-12-28T15:35:28,983     req, self.req_tracker, finder, self.build_isolation,
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
2019-12-28T15:35:28,983     abstract_dist.prepare_distribution_metadata(finder, build_isolation)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
2019-12-28T15:35:28,983     self.req.prepare_metadata()
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
2019-12-28T15:35:28,983     self.metadata_directory = metadata_generator(self)
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/operations/generate_metadata.py", line 124, in _generate_metadata_legacy
2019-12-28T15:35:28,983     command_desc='python setup.py egg_info',
2019-12-28T15:35:28,983   File "/Users/antory/.pyenv/versions/3.6.9/envs/p36env/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
2019-12-28T15:35:28,983     raise InstallationError(exc_msg)
2019-12-28T15:35:28,983 pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Exception: secp256k1_schnorr not enabled

Hi there,
I can't find much information on how to compile libsecp256k1 for Schnorr support, I simply tried to clone the latest version of the lib and compile it and still got the same error. Any ideas?

Some tests fail on FreeBSD (in the port)

== CPU count: 8
Run tests sequentially
0:00:00 load avg: 0.35 [  1/403] test_grammar
0:00:00 load avg: 0.35 [  2/403] test_opcodes
0:00:00 load avg: 0.35 [  3/403] test_dict
0:00:00 load avg: 0.35 [  4/403] test_builtin
0:00:00 load avg: 0.35 [  5/403] test_exceptions
0:00:00 load avg: 0.35 [  6/403] test_types
0:00:00 load avg: 0.35 [  7/403] test_unittest
0:00:00 load avg: 0.35 [  8/403] test_doctest
0:00:00 load avg: 0.35 [  9/403] test_doctest2
0:00:00 load avg: 0.35 [ 10/403] test_MimeWriter
0:00:00 load avg: 0.35 [ 11/403] test_SimpleHTTPServer
0:00:00 load avg: 0.35 [ 12/403] test_StringIO
0:00:01 load avg: 0.35 [ 13/403] test___all__
0:00:02 load avg: 0.35 [ 14/403] test___future__
0:00:02 load avg: 0.35 [ 15/403] test__locale
0:00:02 load avg: 0.35 [ 16/403] test__osx_support
0:00:02 load avg: 0.35 [ 17/403] test_abc
0:00:02 load avg: 0.35 [ 18/403] test_abstract_numbers
0:00:02 load avg: 0.35 [ 19/403] test_aepack
test_aepack skipped -- No module named aetypes
0:00:02 load avg: 0.35 [ 20/403] test_aifc -- test_aepack skipped
0:00:02 load avg: 0.35 [ 21/403] test_al
test_al skipped -- No module named al
0:00:02 load avg: 0.35 [ 22/403] test_anydbm -- test_al skipped
0:00:02 load avg: 0.35 [ 23/403] test_applesingle
test_applesingle skipped -- No module named MacOS
0:00:02 load avg: 0.35 [ 24/403] test_argparse -- test_applesingle skipped
0:00:04 load avg: 0.40 [ 25/403] test_array
0:00:04 load avg: 0.40 [ 26/403] test_ascii_formatd
0:00:04 load avg: 0.40 [ 27/403] test_ast
0:00:04 load avg: 0.40 [ 28/403] test_asynchat
0:00:09 load avg: 0.37 [ 29/403] test_asyncore
Exception in thread Thread-38:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/test/test_asyncore.py", line 728, in <lambda>
    t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500))
  File "/usr/local/lib/python2.7/asyncore.py", line 220, in loop
    poll_fun(timeout, map)
  File "/usr/local/lib/python2.7/asyncore.py", line 145, in poll
    r, w, e = select.select(r, w, e, timeout)
error: (9, 'Bad file descriptor')

0:00:12 load avg: 0.34 [ 30/403] test_atexit
0:00:12 load avg: 0.34 [ 31/403] test_audioop
0:00:12 load avg: 0.34 [ 32/403] test_augassign
0:00:12 load avg: 0.34 [ 33/403] test_base64
0:00:12 load avg: 0.34 [ 34/403] test_bastion
0:00:12 load avg: 0.34 [ 35/403] test_bigaddrspace
0:00:12 load avg: 0.34 [ 36/403] test_bigmem
0:00:13 load avg: 0.34 [ 37/403] test_binascii
0:00:13 load avg: 0.34 [ 38/403] test_binhex
0:00:13 load avg: 0.34 [ 39/403] test_binop
0:00:13 load avg: 0.34 [ 40/403] test_bisect
0:00:13 load avg: 0.34 [ 41/403] test_bool
0:00:13 load avg: 0.34 [ 42/403] test_bsddb
test_bsddb skipped -- No module named _bsddb
0:00:13 load avg: 0.34 [ 43/403] test_bsddb185 -- test_bsddb skipped
0:00:13 load avg: 0.34 [ 44/403] test_bsddb3
test_bsddb3 skipped -- No module named _bsddb
0:00:13 load avg: 0.34 [ 45/403] test_buffer -- test_bsddb3 skipped
0:00:13 load avg: 0.34 [ 46/403] test_bufio
0:00:14 load avg: 0.34 [ 47/403] test_bytes
0:00:15 load avg: 0.34 [ 48/403] test_bz2
0:00:16 load avg: 0.34 [ 49/403] test_calendar
0:00:17 load avg: 0.39 [ 50/403] test_call
0:00:17 load avg: 0.39 [ 51/403] test_capi
0:00:20 load avg: 0.39 [ 52/403] test_cd
test_cd skipped -- No module named cd
0:00:20 load avg: 0.39 [ 53/403] test_cfgparser -- test_cd skipped
0:00:20 load avg: 0.39 [ 54/403] test_cgi
0:00:20 load avg: 0.39 [ 55/403] test_charmapcodec
0:00:21 load avg: 0.39 [ 56/403] test_cl
test_cl skipped -- No module named cl
0:00:21 load avg: 0.39 [ 57/403] test_class -- test_cl skipped
0:00:21 load avg: 0.39 [ 58/403] test_cmath
0:00:21 load avg: 0.39 [ 59/403] test_cmd
0:00:21 load avg: 0.39 [ 60/403] test_cmd_line
0:00:21 load avg: 0.39 [ 61/403] test_cmd_line_script
0:00:22 load avg: 0.44 [ 62/403] test_code
0:00:22 load avg: 0.44 [ 63/403] test_codeccallbacks
0:00:22 load avg: 0.44 [ 64/403] test_codecencodings_cn
0:00:22 load avg: 0.44 [ 65/403] test_codecencodings_hk
0:00:22 load avg: 0.44 [ 66/403] test_codecencodings_iso2022
0:00:23 load avg: 0.44 [ 67/403] test_codecencodings_jp
0:00:24 load avg: 0.44 [ 68/403] test_codecencodings_kr
0:00:24 load avg: 0.44 [ 69/403] test_codecencodings_tw
0:00:24 load avg: 0.44 [ 70/403] test_codecmaps_cn
test_codecmaps_cn skipped -- Use of the `urlfetch' resource not enabled
0:00:24 load avg: 0.44 [ 71/403] test_codecmaps_hk -- test_codecmaps_cn skipped (resource denied)
test_codecmaps_hk skipped -- Use of the `urlfetch' resource not enabled
0:00:25 load avg: 0.44 [ 72/403] test_codecmaps_jp -- test_codecmaps_hk skipped (resource denied)
test_codecmaps_jp skipped -- Use of the `urlfetch' resource not enabled
0:00:25 load avg: 0.44 [ 73/403] test_codecmaps_kr -- test_codecmaps_jp skipped (resource denied)
test_codecmaps_kr skipped -- Use of the `urlfetch' resource not enabled
0:00:25 load avg: 0.44 [ 74/403] test_codecmaps_tw -- test_codecmaps_kr skipped (resource denied)
test_codecmaps_tw skipped -- Use of the `urlfetch' resource not enabled
0:00:25 load avg: 0.44 [ 75/403] test_codecs -- test_codecmaps_tw skipped (resource denied)
0:00:26 load avg: 0.44 [ 76/403] test_codeop
0:00:26 load avg: 0.44 [ 77/403] test_coercion
0:00:26 load avg: 0.44 [ 78/403] test_collections
0:00:27 load avg: 0.44 [ 79/403] test_colorsys
0:00:27 load avg: 0.49 [ 80/403] test_commands
0:00:27 load avg: 0.49 [ 81/403] test_compare
0:00:27 load avg: 0.49 [ 82/403] test_compile
0:00:27 load avg: 0.49 [ 83/403] test_compileall
0:00:27 load avg: 0.49 [ 84/403] test_compiler
0:00:27 load avg: 0.49 [ 85/403] test_complex
0:00:28 load avg: 0.49 [ 86/403] test_complex_args
0:00:28 load avg: 0.49 [ 87/403] test_contains
0:00:28 load avg: 0.49 [ 88/403] test_contextlib
0:00:28 load avg: 0.49 [ 89/403] test_cookie
0:00:28 load avg: 0.49 [ 90/403] test_cookielib
0:00:28 load avg: 0.49 [ 91/403] test_copy
0:00:28 load avg: 0.49 [ 92/403] test_copy_reg
0:00:28 load avg: 0.49 [ 93/403] test_cpickle
0:00:30 load avg: 0.49 [ 94/403] test_cprofile
0:00:30 load avg: 0.49 [ 95/403] test_crypt
0:00:30 load avg: 0.49 [ 96/403] test_csv
0:00:30 load avg: 0.49 [ 97/403] test_ctypes
0:00:32 load avg: 0.49 [ 98/403] test_curses
test_curses skipped -- Use of the `curses' resource not enabled
0:00:32 load avg: 0.49 [ 99/403] test_datetime -- test_curses skipped (resource denied)
0:00:33 load avg: 0.45 [100/403] test_dbm
0:00:33 load avg: 0.45 [101/403] test_decimal
0:00:34 load avg: 0.45 [102/403] test_decorators
0:00:34 load avg: 0.45 [103/403] test_defaultdict
0:00:34 load avg: 0.45 [104/403] test_deque
0:00:37 load avg: 0.45 [105/403] test_descr
0:00:38 load avg: 0.49 [106/403] test_descrtut
0:00:38 load avg: 0.49 [107/403] test_dictcomps
0:00:38 load avg: 0.49 [108/403] test_dictviews
0:00:38 load avg: 0.49 [109/403] test_difflib
0:00:39 load avg: 0.49 [110/403] test_dircache
0:00:40 load avg: 0.49 [111/403] test_dis
0:00:41 load avg: 0.49 [112/403] test_distutils
0:00:42 load avg: 0.49 [113/403] test_dl
test_dl skipped -- No module named dl
0:00:42 load avg: 0.49 [114/403] test_docxmlrpc -- test_dl skipped
0:00:45 load avg: 0.45 [115/403] test_dumbdbm
0:00:45 load avg: 0.45 [116/403] test_dummy_thread
0:00:45 load avg: 0.45 [117/403] test_dummy_threading
0:00:45 load avg: 0.45 [118/403] test_email
0:00:49 load avg: 0.74 [119/403] test_email_codecs
0:00:49 load avg: 0.74 [120/403] test_email_renamed
0:00:49 load avg: 0.74 [121/403] test_ensurepip
0:00:49 load avg: 0.74 [122/403] test_enumerate
0:00:49 load avg: 0.74 [123/403] test_eof
0:00:49 load avg: 0.74 [124/403] test_epoll
test_epoll skipped -- test works only on Linux 2.6
0:00:49 load avg: 0.74 [125/403] test_errno -- test_epoll skipped
0:00:49 load avg: 0.74 [126/403] test_exception_variations
0:00:50 load avg: 0.74 [127/403] test_extcall
0:00:50 load avg: 0.74 [128/403] test_fcntl
0:00:50 load avg: 0.74 [129/403] test_file
0:00:50 load avg: 0.74 [130/403] test_file2k
0:00:57 load avg: 0.76 [131/403] test_file_eintr
0:00:58 load avg: 0.78 [132/403] test_filecmp
0:00:58 load avg: 0.78 [133/403] test_fileinput
0:00:58 load avg: 0.78 [134/403] test_fileio
0:00:58 load avg: 0.78 [135/403] test_float
0:00:59 load avg: 0.78 [136/403] test_fnmatch
0:00:59 load avg: 0.78 [137/403] test_fork1
0:01:04 load avg: 0.71 [138/403] test_format
0:01:04 load avg: 0.71 [139/403] test_fpformat
0:01:05 load avg: 0.71 [140/403] test_fractions
0:01:05 load avg: 0.71 [141/403] test_frozen
0:01:05 load avg: 0.71 [142/403] test_ftplib
0:01:09 load avg: 0.66 [143/403] test_funcattrs
0:01:09 load avg: 0.66 [144/403] test_functools
0:01:09 load avg: 0.66 [145/403] test_future
0:01:09 load avg: 0.66 [146/403] test_future3
0:01:09 load avg: 0.66 [147/403] test_future4
0:01:09 load avg: 0.66 [148/403] test_future5
0:01:09 load avg: 0.66 [149/403] test_future_builtins
0:01:09 load avg: 0.66 [150/403] test_gc
0:01:12 load avg: 0.66 [151/403] test_gdb
test_gdb skipped -- test_gdb only works on source builds at the moment.
0:01:12 load avg: 0.66 [152/403] test_gdbm -- test_gdb skipped
test_gdbm skipped -- No module named gdbm
0:01:12 load avg: 0.68 [153/403] test_generators -- test_gdbm skipped
0:01:12 load avg: 0.68 [154/403] test_genericpath
0:01:12 load avg: 0.68 [155/403] test_genexps
0:01:13 load avg: 0.68 [156/403] test_getargs
0:01:13 load avg: 0.68 [157/403] test_getargs2
0:01:13 load avg: 0.68 [158/403] test_getopt
0:01:13 load avg: 0.68 [159/403] test_gettext
0:01:13 load avg: 0.68 [160/403] test_gl
test_gl skipped -- No module named gl
0:01:13 load avg: 0.68 [161/403] test_glob -- test_gl skipped
0:01:13 load avg: 0.68 [162/403] test_global
0:01:13 load avg: 0.68 [163/403] test_grp
0:01:13 load avg: 0.68 [164/403] test_gzip
0:01:13 load avg: 0.68 [165/403] test_hash
0:01:14 load avg: 0.68 [166/403] test_hashlib
0:01:14 load avg: 0.68 [167/403] test_heapq
0:01:15 load avg: 0.68 [168/403] test_hmac
0:01:15 load avg: 0.68 [169/403] test_hotshot
0:01:15 load avg: 0.68 [170/403] test_htmllib
0:01:15 load avg: 0.68 [171/403] test_htmlparser
0:01:15 load avg: 0.68 [172/403] test_httplib
0:01:16 load avg: 0.68 [173/403] test_httpservers
0:01:18 load avg: 0.63 [174/403] test_idle
0:01:18 load avg: 0.63 [175/403] test_imageop
test_imageop skipped -- No module named imageop
0:01:18 load avg: 0.63 [176/403] test_imaplib -- test_imageop skipped
0:01:18 load avg: 0.63 [177/403] test_imgfile
test_imgfile skipped -- No module named imgfile
0:01:18 load avg: 0.63 [178/403] test_imghdr -- test_imgfile skipped
0:01:18 load avg: 0.63 [179/403] test_imp
0:01:18 load avg: 0.63 [180/403] test_import
0:01:19 load avg: 0.63 [181/403] test_import_magic
0:01:19 load avg: 0.63 [182/403] test_importhooks
0:01:19 load avg: 0.63 [183/403] test_importlib
0:01:19 load avg: 0.63 [184/403] test_index
0:01:19 load avg: 0.63 [185/403] test_inspect
0:01:19 load avg: 0.63 [186/403] test_int
0:01:20 load avg: 0.63 [187/403] test_int_literal
0:01:20 load avg: 0.63 [188/403] test_io
0:01:58 load avg: 0.78 [189/403] test_ioctl -- test_io passed in 37 sec
0:01:58 load avg: 0.78 [190/403] test_isinstance
0:01:58 load avg: 0.78 [191/403] test_iter
0:01:58 load avg: 0.78 [192/403] test_iterlen
0:01:58 load avg: 0.78 [193/403] test_itertools
0:02:03 load avg: 0.88 [194/403] test_json
0:02:05 load avg: 0.88 [195/403] test_kqueue
0:02:05 load avg: 0.88 [196/403] test_largefile
0:02:05 load avg: 0.88 [197/403] test_lib2to3
0:02:26 load avg: 0.99 [198/403] test_linecache
0:02:26 load avg: 0.99 [199/403] test_linuxaudiodev
test_linuxaudiodev skipped -- Use of the `audio' resource not enabled
0:02:27 load avg: 0.99 [200/403] test_list -- test_linuxaudiodev skipped (resource denied)
0:02:27 load avg: 0.99 [201/403] test_locale
0:02:27 load avg: 0.99 [202/403] test_logging
0:02:38 load avg: 0.91 [203/403] test_long
0:02:40 load avg: 0.91 [204/403] test_long_future
0:02:42 load avg: 0.91 [205/403] test_longexp
0:02:42 load avg: 0.92 [206/403] test_macos
test_macos skipped -- No module named MacOS
0:02:42 load avg: 0.92 [207/403] test_macostools -- test_macos skipped
test_macostools skipped -- No module named MacOS
0:02:42 load avg: 0.92 [208/403] test_macpath -- test_macostools skipped
0:02:42 load avg: 0.92 [209/403] test_macurl2path
0:02:42 load avg: 0.92 [210/403] test_mailbox
0:02:43 load avg: 0.92 [211/403] test_marshal
0:02:43 load avg: 0.92 [212/403] test_math
0:02:45 load avg: 0.92 [213/403] test_md5
0:02:45 load avg: 0.92 [214/403] test_memoryio
0:02:45 load avg: 0.92 [215/403] test_memoryview
0:02:45 load avg: 0.92 [216/403] test_mhlib
0:02:45 load avg: 0.92 [217/403] test_mimetools
0:02:45 load avg: 0.92 [218/403] test_mimetypes
0:02:46 load avg: 0.92 [219/403] test_minidom
0:02:46 load avg: 0.92 [220/403] test_mmap
0:02:46 load avg: 0.92 [221/403] test_module
0:02:46 load avg: 0.92 [222/403] test_modulefinder
0:02:46 load avg: 0.92 [223/403] test_msilib
test_msilib skipped -- No module named msilib
0:02:47 load avg: 0.92 [224/403] test_multibytecodec -- test_msilib skipped
0:02:48 load avg: 0.92 [225/403] test_multifile
0:02:48 load avg: 0.92 [226/403] test_multiprocessing
Process Process-16:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
    self.run()
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python2.7/test/test_multiprocessing.py", line 1774, in _writefd
    fd = reduction.recv_handle(conn)
  File "/usr/local/lib/python2.7/multiprocessing/reduction.py", line 83, in recv_handle
    return _multiprocessing.recvfd(conn.fileno())
RuntimeError: No file descriptor received
Process Process-17:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
    self.run()
  File "/usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python2.7/test/test_multiprocessing.py", line 1774, in _writefd
    fd = reduction.recv_handle(conn)
  File "/usr/local/lib/python2.7/multiprocessing/reduction.py", line 83, in recv_handle
    return _multiprocessing.recvfd(conn.fileno())
RuntimeError: No file descriptor received
test test_multiprocessing failed -- multiple errors occurred; run in verbose mode for details
0:03:16 load avg: 0.80 [227/403/1] test_mutants -- test_multiprocessing failed
0:03:16 load avg: 0.80 [228/403/1] test_mutex
0:03:17 load avg: 0.80 [229/403/1] test_netrc
0:03:17 load avg: 0.80 [230/403/1] test_new
0:03:17 load avg: 0.80 [231/403/1] test_nis
0:03:17 load avg: 0.82 [232/403/1] test_nntplib
0:03:17 load avg: 0.82 [233/403/1] test_normalization
0:03:17 load avg: 0.82 [234/403/1] test_ntpath
0:03:17 load avg: 0.82 [235/403/1] test_old_mailbox
0:03:17 load avg: 0.82 [236/403/1] test_openpty
0:03:17 load avg: 0.82 [237/403/1] test_operator
0:03:17 load avg: 0.82 [238/403/1] test_optparse
0:03:18 load avg: 0.82 [239/403/1] test_ordered_dict
0:03:18 load avg: 0.82 [240/403/1] test_os
0:03:19 load avg: 0.82 [241/403/1] test_ossaudiodev
test_ossaudiodev skipped -- Use of the `audio' resource not enabled
0:03:19 load avg: 0.82 [242/403/1] test_parser -- test_ossaudiodev skipped (resource denied)
0:03:19 load avg: 0.82 [243/403/1] test_pdb
0:03:19 load avg: 0.82 [244/403/1] test_peepholer
0:03:19 load avg: 0.82 [245/403/1] test_pep247
0:03:19 load avg: 0.82 [246/403/1] test_pep277
test_pep277 skipped -- only NT+ and systems with Unicode-friendly filesystem encoding
0:03:19 load avg: 0.82 [247/403/1] test_pep352 -- test_pep277 skipped
0:03:19 load avg: 0.82 [248/403/1] test_pickle
0:03:22 load avg: 0.83 [249/403/1] test_pickletools
0:03:23 load avg: 0.83 [250/403/1] test_pipes
0:03:23 load avg: 0.83 [251/403/1] test_pkg
0:03:23 load avg: 0.83 [252/403/1] test_pkgimport
0:03:23 load avg: 0.83 [253/403/1] test_pkgutil
0:03:23 load avg: 0.83 [254/403/1] test_platform
0:03:23 load avg: 0.83 [255/403/1] test_plistlib
0:03:23 load avg: 0.83 [256/403/1] test_poll
0:03:34 load avg: 0.86 [257/403/1] test_popen
0:03:35 load avg: 0.86 [258/403/1] test_popen2
0:03:35 load avg: 0.86 [259/403/1] test_poplib
0:03:39 load avg: 0.79 [260/403/1] test_posix
test test_posix failed -- Traceback (most recent call last):
  File "/usr/local/lib/python2.7/test/test_posix.py", line 283, in test_makedev
    self.assertGreaterEqual(minor, 0)
AssertionError: -2030043135 not greater than or equal to 0

0:03:39 load avg: 0.79 [261/403/2] test_posixpath -- test_posix failed
0:03:39 load avg: 0.79 [262/403/2] test_pow
0:03:39 load avg: 0.79 [263/403/2] test_pprint
0:03:40 load avg: 0.79 [264/403/2] test_print
0:03:40 load avg: 0.79 [265/403/2] test_profile
0:03:40 load avg: 0.79 [266/403/2] test_property
0:03:40 load avg: 0.79 [267/403/2] test_pstats
0:03:40 load avg: 0.79 [268/403/2] test_pty
0:03:40 load avg: 0.79 [269/403/2] test_pwd
0:03:40 load avg: 0.79 [270/403/2] test_py3kwarn
test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag
0:03:40 load avg: 0.79 [271/403/2] test_py_compile -- test_py3kwarn skipped
0:03:40 load avg: 0.79 [272/403/2] test_pyclbr
0:03:41 load avg: 0.79 [273/403/2] test_pydoc
0:03:42 load avg: 0.80 [274/403/2] test_pyexpat
0:03:42 load avg: 0.80 [275/403/2] test_queue
0:03:46 load avg: 0.80 [276/403/2] test_quopri
0:03:46 load avg: 0.80 [277/403/2] test_random
0:03:47 load avg: 0.74 [278/403/2] test_re
0:03:48 load avg: 0.74 [279/403/2] test_readline
0:03:48 load avg: 0.74 [280/403/2] test_regrtest
0:03:50 load avg: 0.76 [281/403/2] test_repr
0:03:51 load avg: 0.76 [282/403/2] test_resource
0:03:51 load avg: 0.76 [283/403/2] test_rfc822
0:03:51 load avg: 0.76 [284/403/2] test_richcmp
0:03:51 load avg: 0.76 [285/403/2] test_rlcompleter
0:03:51 load avg: 0.76 [286/403/2] test_robotparser
0:03:51 load avg: 0.76 [287/403/2] test_runpy
0:03:54 load avg: 0.76 [288/403/2] test_sax
0:03:54 load avg: 0.76 [289/403/2] test_scope
0:03:54 load avg: 0.76 [290/403/2] test_scriptpackages
test_scriptpackages skipped -- No module named aetools
0:03:54 load avg: 0.76 [291/403/2] test_select -- test_scriptpackages skipped
0:04:06 load avg: 0.64 [292/403/2] test_set
0:04:07 load avg: 0.75 [293/403/2] test_setcomps
0:04:07 load avg: 0.75 [294/403/2] test_sets
0:04:07 load avg: 0.75 [295/403/2] test_sgmllib
0:04:07 load avg: 0.75 [296/403/2] test_sha
0:04:07 load avg: 0.75 [297/403/2] test_shelve
0:04:07 load avg: 0.75 [298/403/2] test_shlex
0:04:07 load avg: 0.75 [299/403/2] test_shutil
0:04:07 load avg: 0.75 [300/403/2] test_signal
0:04:15 load avg: 0.72 [301/403/2] test_site
0:04:15 load avg: 0.72 [302/403/2] test_slice
0:04:15 load avg: 0.72 [303/403/2] test_smtplib
0:04:16 load avg: 0.72 [304/403/2] test_smtpnet
test_smtpnet skipped -- Use of the `network' resource not enabled
0:04:16 load avg: 0.72 [305/403/2] test_socket -- test_smtpnet skipped (resource denied)
0:04:32 load avg: 0.56 [306/403/2] test_socketserver
test_socketserver skipped -- Use of the `network' resource not enabled
0:04:32 load avg: 0.56 [307/403/2] test_softspace -- test_socketserver skipped (resource denied)
0:04:32 load avg: 0.56 [308/403/2] test_sort
0:04:32 load avg: 0.56 [309/403/2] test_source_encoding
0:04:32 load avg: 0.56 [310/403/2] test_spwd
test_spwd skipped -- No module named spwd
0:04:33 load avg: 0.56 [311/403/2] test_sqlite -- test_spwd skipped
0:04:33 load avg: 0.56 [312/403/2] test_ssl
test test_ssl failed -- Traceback (most recent call last):
  File "/usr/local/lib/python2.7/test/test_ssl.py", line 1005, in test_load_dh_params
    shutil.copy(DHFILE, fname)
  File "/usr/local/lib/python2.7/shutil.py", line 131, in copy
    if os.path.isdir(dst):
  File "/usr/local/lib/python2.7/genericpath.py", line 49, in isdir
    st = os.stat(s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 18: ordinal not in range(128)

0:04:34 load avg: 0.56 [313/403/3] test_startfile -- test_ssl failed
test_startfile skipped -- module 'os' has no attribute 'startfile'
0:04:35 load avg: 0.56 [314/403/3] test_stat -- test_startfile skipped
0:04:35 load avg: 0.56 [315/403/3] test_str
0:04:36 load avg: 0.59 [316/403/3] test_strftime
0:04:37 load avg: 0.59 [317/403/3] test_string
0:04:38 load avg: 0.59 [318/403/3] test_stringprep
0:04:38 load avg: 0.59 [319/403/3] test_strop
0:04:38 load avg: 0.59 [320/403/3] test_strptime
0:04:38 load avg: 0.59 [321/403/3] test_strtod
0:04:39 load avg: 0.59 [322/403/3] test_struct
0:04:40 load avg: 0.62 [323/403/3] test_structmembers
0:04:40 load avg: 0.62 [324/403/3] test_structseq
0:04:41 load avg: 0.62 [325/403/3] test_subprocess
0:05:46 load avg: 0.93 [326/403/3] test_sunau -- test_subprocess passed in 1 min 5 sec
0:05:46 load avg: 0.93 [327/403/3] test_sunaudiodev
test_sunaudiodev skipped -- No module named sunaudiodev
0:05:46 load avg: 0.93 [328/403/3] test_sundry -- test_sunaudiodev skipped
0:05:46 load avg: 0.93 [329/403/3] test_symtable
0:05:46 load avg: 0.93 [330/403/3] test_syntax
0:05:46 load avg: 0.93 [331/403/3] test_sys
0:05:47 load avg: 0.93 [332/403/3] test_sys_setprofile
0:05:47 load avg: 0.93 [333/403/3] test_sys_settrace
0:05:47 load avg: 0.93 [334/403/3] test_sysconfig
0:05:47 load avg: 0.93 [335/403/3] test_tarfile
0:05:49 load avg: 0.93 [336/403/3] test_tcl
0:05:49 load avg: 0.93 [337/403/3] test_telnetlib
0:05:54 load avg: 0.86 [338/403/3] test_tempfile
0:05:55 load avg: 0.86 [339/403/3] test_test_support
0:05:55 load avg: 0.86 [340/403/3] test_textwrap
0:05:55 load avg: 0.86 [341/403/3] test_thread
0:05:55 load avg: 0.86 [342/403/3] test_threaded_import
0:05:55 load avg: 0.86 [343/403/3] test_threadedtempfile
0:05:56 load avg: 0.86 [344/403/3] test_threading
0:05:59 load avg: 0.79 [345/403/3] test_threading_local
0:06:00 load avg: 0.79 [346/403/3] test_threadsignals
0:06:00 load avg: 0.79 [347/403/3] test_time
0:06:01 load avg: 0.79 [348/403/3] test_timeit
0:06:02 load avg: 0.79 [349/403/3] test_timeout
test_timeout skipped -- Use of the `network' resource not enabled
0:06:02 load avg: 0.89 [350/403/3] test_tk -- test_timeout skipped (resource denied)
test_tk skipped -- Use of the `gui' resource not enabled
0:06:02 load avg: 0.89 [351/403/3] test_tokenize -- test_tk skipped (resource denied)
0:06:02 load avg: 0.89 [352/403/3] test_tools
test_tools skipped -- test irrelevant for an installed Python
0:06:02 load avg: 0.89 [353/403/3] test_trace -- test_tools skipped
0:06:04 load avg: 0.89 [354/403/3] test_traceback
0:06:08 load avg: 0.81 [355/403/3] test_transformer
0:06:08 load avg: 0.81 [356/403/3] test_ttk_guionly
test_ttk_guionly skipped -- Use of the `gui' resource not enabled
0:06:09 load avg: 0.81 [357/403/3] test_ttk_textonly -- test_ttk_guionly skipped (resource denied)
0:06:09 load avg: 0.81 [358/403/3] test_tuple
0:06:16 load avg: 0.83 [359/403/3] test_turtle
0:06:16 load avg: 0.83 [360/403/3] test_typechecks
0:06:16 load avg: 0.83 [361/403/3] test_ucn
0:06:16 load avg: 0.83 [362/403/3] test_unary
0:06:16 load avg: 0.83 [363/403/3] test_undocumented_details
0:06:17 load avg: 0.83 [364/403/3] test_unicode
0:06:33 load avg: 0.88 [365/403/3] test_unicode_file
test_unicode_file skipped -- No Unicode filesystem semantics on this platform.
0:06:33 load avg: 0.88 [366/403/3] test_unicodedata -- test_unicode_file skipped
0:06:37 load avg: 0.88 [367/403/3] test_univnewlines
0:06:37 load avg: 0.88 [368/403/3] test_univnewlines2k
0:06:37 load avg: 0.88 [369/403/3] test_unpack
0:06:37 load avg: 0.88 [370/403/3] test_urllib
0:06:37 load avg: 0.88 [371/403/3] test_urllib2
0:06:37 load avg: 0.88 [372/403/3] test_urllib2_localnet
0:06:39 load avg: 0.81 [373/403/3] test_urllib2net
test_urllib2net skipped -- Use of the `network' resource not enabled
0:06:39 load avg: 0.81 [374/403/3] test_urllibnet -- test_urllib2net skipped (resource denied)
test_urllibnet skipped -- Use of the `network' resource not enabled
0:06:39 load avg: 0.81 [375/403/3] test_urlparse -- test_urllibnet skipped (resource denied)
0:06:39 load avg: 0.81 [376/403/3] test_userdict
0:06:40 load avg: 0.81 [377/403/3] test_userlist
0:06:41 load avg: 0.81 [378/403/3] test_userstring
0:06:45 load avg: 0.82 [379/403/3] test_uu
0:06:45 load avg: 0.82 [380/403/3] test_uuid
0:06:45 load avg: 0.82 [381/403/3] test_wait3
0:06:51 load avg: 0.84 [382/403/3] test_wait4
0:06:56 load avg: 0.85 [383/403/3] test_warnings
0:06:57 load avg: 0.85 [384/403/3] test_wave
0:06:57 load avg: 0.85 [385/403/3] test_weakref
0:07:11 load avg: 1.03 [386/403/3] test_weakset
0:07:12 load avg: 1.03 [387/403/3] test_whichdb
0:07:12 load avg: 1.03 [388/403/3] test_winreg
test_winreg skipped -- No module named _winreg
0:07:12 load avg: 1.03 [389/403/3] test_winsound -- test_winreg skipped
test_winsound skipped -- Use of the `audio' resource not enabled
0:07:12 load avg: 1.03 [390/403/3] test_with -- test_winsound skipped (resource denied)
0:07:12 load avg: 1.03 [391/403/3] test_wsgiref
0:07:12 load avg: 1.03 [392/403/3] test_xdrlib
0:07:12 load avg: 1.03 [393/403/3] test_xml_etree
0:07:13 load avg: 1.03 [394/403/3] test_xml_etree_c
0:07:13 load avg: 1.03 [395/403/3] test_xmllib
0:07:13 load avg: 1.03 [396/403/3] test_xmlrpc
0:07:16 load avg: 1.03 [397/403/3] test_xpickle
0:07:17 load avg: 1.03 [398/403/3] test_xrange
0:07:17 load avg: 1.03 [399/403/3] test_zipfile
0:07:20 load avg: 1.03 [400/403/3] test_zipfile64
test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run
0:07:21 load avg: 1.03 [401/403/3] test_zipimport -- test_zipfile64 skipped (resource denied)
0:07:21 load avg: 1.03 [402/403/3] test_zipimport_support
0:07:21 load avg: 1.03 [403/403/3] test_zlib
357 tests OK.
3 tests failed:
    test_multiprocessing test_posix test_ssl
43 tests skipped:
    test_aepack test_al test_applesingle test_bsddb test_bsddb3
    test_cd test_cl test_codecmaps_cn test_codecmaps_hk
    test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses
    test_dl test_epoll test_gdb test_gdbm test_gl test_imageop
    test_imgfile test_linuxaudiodev test_macos test_macostools
    test_msilib test_ossaudiodev test_pep277 test_py3kwarn
    test_scriptpackages test_smtpnet test_socketserver test_spwd
    test_startfile test_sunaudiodev test_timeout test_tk test_tools
    test_ttk_guionly test_unicode_file test_urllib2net test_urllibnet
    test_winreg test_winsound test_zipfile64
Ask someone to teach regrtest.py about which tests are
expected to get skipped on freebsd11.

Total duration: 7 min 24 sec
Tests result: FAILURE

[libsecp256k1] illegal argument: Invalid flags

Getting this whenever I run any of the examples dealing with secp256k1_context_create.

The values being passed in look right (1/2/3). Ideas?

edit: Realized I'm getting the same issue on my random code now too. Maybe connected to me updating the base library.

Not able to install python package secp256k1

I am getting the below error while installing secp256k1 package. I am using python3.6 version

0.28
Using bundled libsecp256k1
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\secp256k1
copying secp256k1_init_.py -> build\lib.win-amd64-3.5\secp256k1
copying secp256k1_main_.py -> build\lib.win-amd64-3.5\secp256k1
running build_clib
error: [WinError 193] %1 is not a valid Win32 application

Build on debian 9 with OpenSSL 1.1.0f

Follow the error output , during compile with openssl-1.1.0f

user@hermes:/Projects/deb_dist/secp256k1-0.13.2$ dpkg-buildpackage
dpkg-buildpackage: info: source package secp256k1
dpkg-buildpackage: info: source version 0.13.2-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Ludvig Broberg [email protected]
dpkg-buildpackage: info: host architecture amd64
dpkg-source --before-build secp256k1-0.13.2
fakeroot debian/rules clean
dh clean --with python2,python3 --buildsystem=pybuild
dh_testdir -O--buildsystem=pybuild
dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:184: python2.7 setup.py clean
0.29
Using bundled libsecp256k1
running clean
removing '/home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build' (and everything under it)
'build/bdist.linux-amd64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
I: pybuild base:184: python3.5 setup.py clean
0.29
Using bundled libsecp256k1
running clean
removing '/home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_3.5/build' (and everything under it)
'build/bdist.linux-amd64' does not exist -- can't clean it
'build/scripts-3.5' does not exist -- can't clean it
dh_clean -O--buildsystem=pybuild
dpkg-source -b secp256k1-0.13.2
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building secp256k1 using existing ./secp256k1_0.13.2.orig.tar.gz
dpkg-source: info: building secp256k1 in secp256k1_0.13.2-1.debian.tar.xz
dpkg-source: info: building secp256k1 in secp256k1_0.13.2-1.dsc
debian/rules build
dh build --with python2,python3 --buildsystem=pybuild
dh_testdir -O--buildsystem=pybuild
dh_update_autotools_config -O--buildsystem=pybuild
dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:184: python2.7 setup.py config
0.29
Using bundled libsecp256k1
running config
I: pybuild base:184: python3.5 setup.py config
0.29
Using bundled libsecp256k1
running config
dh_auto_build -O--buildsystem=pybuild
I: pybuild base:184: /usr/bin/python setup.py build
0.29
Using bundled libsecp256k1
running build
running build_py
creating /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
copying secp256k1/main.py -> /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
copying secp256k1/init.py -> /home/user/Projects/deb_dist/secp256k1-0.13.2/.pybuild/pythonX.Y_2.7/build/secp256k1
running build_clib
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
libtoolize: copying file 'build-aux/m4/ltsugar.m4'
libtoolize: copying file 'build-aux/m4/ltversion.m4'
libtoolize: copying file 'build-aux/m4/lt
obsolete.m4'
configure.ac:10: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/config.guess'
configure.ac:5: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking for gcc... gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) none
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... none
checking if gcc supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
checking if gcc supports -fvisibility=hidden... yes
checking for __int128... yes
checking for __builtin_expect... yes
checking native compiler: gcc... ok
checking for x86_64 assembly availability... yes
checking for CRYPTO... yes
checking for main in -lcrypto... yes
checking for EC functions in libcrypto... yes
checking for javac... /usr/bin/javac
checking symlink for /usr/bin/javac... /etc/alternatives/javac
checking symlink for /etc/alternatives/javac... /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
checking jni headers... /usr/lib/jvm/java-8-openjdk-amd64/include
configure: WARNING: jni headers/dependencies not found. jni support disabled
checking whether byte ordering is bigendian... no
configure: Using static precomputation: yes
configure: Using assembly optimizations: x86_64
configure: Using field implementation: 64bit
configure: Using bignum implementation: no
configure: Using scalar implementation: 64bit
configure: Using endomorphism optimizations: no
configure: Building ECDH module: no
configure: Building Schnorr signatures module: no
configure: Building ECDSA pubkey recovery module: yes
configure: Using jni: no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsecp256k1.pc
config.status: creating src/libsecp256k1-config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make[1]: Entering directory '/home/user/Projects/deb_dist/secp256k1-0.13.2/build/temp.linux-amd64-2.7'
CC src/libsecp256k1_la-secp256k1.lo
In file included from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/secp256k1.c:14:0:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
memcpy(dst->pre_g, src->pre_g, size);
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(wnaf, 0, len * sizeof(wnaf[0]));
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
CCLD libsecp256k1.la
/usr/bin/ar: u' modifier ignored since D' is the default (see `U')
CC src/tests-tests.o
In file included from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/secp256k1.c:14:0,
from /home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c:16:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
memcpy(dst->pre_g, src->pre_g, size);
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(wnaf, 0, len * sizeof(wnaf[0]));
^~~~~~
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c: In function ‘test_ecdsa_der_parse’:
/home/user/Projects/deb_dist/secp256k1-0.13.2/libsecp256k1/src/tests.c:3702:52: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’
valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256;
^~
Makefile:1049: recipe for target 'src/tests-tests.o' failed
make[1]: *** [src/tests-tests.o] Error 1
make[1]: Leaving directory '/home/user/Projects/deb_dist/secp256k1-0.13.2/build/temp.linux-amd64-2.7'
Traceback (most recent call last):
File "setup.py", line 295, in
"Topic :: Security :: Cryptography"
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 217, in run
subprocess.check_call(["make"], cwd=build_temp)
File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2
E: pybuild pybuild:283: build: plugin distutils failed with: exit code=1: /usr/bin/python setup.py build
dh_auto_build: pybuild --build -i python{version} -p 2.7 returned exit code 13
debian/rules:7: recipe for target 'build' failed
make: *** [build] Error 25
dpkg-buildpackage: error: debian/rules build gave error exit status 2

undefined symbol: secp256k1_ecdsa_recoverable_signature_parse_compact

When trying to run the following from the same dir that I have the test suite passing, I get this error. Which is very weird since the tests are passing. Maybe I have installed in a wrong way, but have tried both through pip and by cloning your repo and installing it manually.

$ python -m secp256k1 privkey -p                                               
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "~/ludbb_secp256k1/secp256k1-py/secp256k1.py", line 5, in <module>
    from _libsecp256k1 import ffi, lib
ImportError: ./_libsecp256k1.so: undefined symbol: secp256k1_ecdsa_recoverable_signature_parse_compact

OSX Installation Broken

pip install secp256k1
Collecting secp256k1
  Using cached secp256k1-0.13.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.3.0 in ./env/lib/python2.7/site-packages (from secp256k1)
Requirement already satisfied (use --upgrade to upgrade): pycparser in ./env/lib/python2.7/site-packages (from cffi>=1.3.0->secp256k1)
Building wheels for collected packages: secp256k1
  Running setup.py bdist_wheel for secp256k1 ... error
  Complete output from command /Users/rjones/Projects/DVoting/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/tmpr6EKeMpip-wheel- --python-tag cp27:
  0.29
  Using bundled libsecp256k1
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.10-x86_64-2.7
  creating build/lib.macosx-10.10-x86_64-2.7/secp256k1
  copying secp256k1/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/secp256k1
  running build_clib
  /usr/local/bin/glibtoolize: line 406: /usr/local/Library/ENV/4.3/sed: No such file or directory
  /usr/local/bin/glibtoolize: line 2513: /usr/local/Library/ENV/4.3/sed: No such file or directory
  /usr/local/bin/glibtoolize: line 2513: /usr/local/Library/ENV/4.3/sed: No such file or directory
  /usr/local/bin/glibtoolize: line 3601: /usr/local/Library/ENV/4.3/sed: No such file or directory
  /usr/local/bin/glibtoolize: line 3845: /usr/local/Library/ENV/4.3/sed: No such file or directory
  /usr/local/bin/glibtoolize: line 861: /usr/local/Library/ENV/4.3/sed: No such file or directory
  : putting auxiliary files in '.'.
  : copying file './ltmain.sh'
  /usr/local/bin/glibtoolize: line 3771: /usr/local/Library/ENV/4.3/sed: No such file or directory
  configure.ac:10: installing 'build-aux/compile'
  configure.ac:5: installing 'build-aux/config.guess'
  configure.ac:5: installing 'build-aux/config.sub'
  configure.ac:9: installing 'build-aux/install-sh'
  configure.ac:10: error: required file 'build-aux/ltmain.sh' not found
  configure.ac:9: installing 'build-aux/missing'
  Makefile.am: installing 'build-aux/depcomp'
  parallel-tests: installing 'build-aux/test-driver'
  autoreconf: automake failed with exit status: 1
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py", line 274, in <module>
      "Topic :: Security :: Cryptography"
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/Users/rjones/Projects/DVoting/env/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 179, in run
      self.run_command('build')
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
      self.run_command(cmd_name)
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py", line 151, in run
      cwd=absolute("libsecp256k1"),
    File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/libsecp256k1/autogen.sh']' returned non-zero exit status 1

  ----------------------------------------
  Failed building wheel for secp256k1
  Running setup.py clean for secp256k1
Failed to build secp256k1
Installing collected packages: secp256k1
  Running setup.py install for secp256k1 ... error
    Complete output from command /Users/rjones/Projects/DVoting/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-g7qrqK-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/rjones/Projects/DVoting/env/bin/../include/site/python2.7/secp256k1:
    0.29
    Using bundled libsecp256k1
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.10-x86_64-2.7
    creating build/lib.macosx-10.10-x86_64-2.7/secp256k1
    copying secp256k1/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/secp256k1
    running build_clib
    checking build system type... x86_64-apple-darwin14.5.0
    checking host system type... x86_64-apple-darwin14.5.0
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/libsecp256k1/build-aux/install-sh -c -d
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking how to print strings... printf
    checking for style of include used by make... GNU
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking dependency style of gcc... none
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for fgrep... /usr/bin/grep -F
    checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
    checking the name lister (/usr/bin/nm) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 196608
    checking how to convert x86_64-apple-darwin14.5.0 file names to x86_64-apple-darwin14.5.0 format... func_convert_file_noop
    checking how to convert x86_64-apple-darwin14.5.0 file names to toolchain format... func_convert_file_noop
    checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
    checking for objdump... no
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... no
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... no
    checking if : is a manifest tool... no
    checking for dsymutil... dsymutil
    checking for nmedit... nmedit
    checking for lipo... lipo
    checking for otool... otool
    checking for otool64... no
    checking for -single_module linker flag... yes
    checking for -exported_symbols_list linker flag... yes
    checking for -force_load linker flag... yes
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... yes
    checking for gcc option to produce PIC... -fno-common -DPIC
    checking if gcc PIC flag -fno-common -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... darwin14.5.0 dyld
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... no
    checking whether to build static libraries... yes
    checking whether make supports nested variables... (cached) yes
    checking for pkg-config... /usr/local/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    checking for ar... /usr/bin/ar
    checking for ranlib... /usr/bin/ranlib
    checking for strip... /usr/bin/strip
    checking for gcc... gcc
    checking whether we are using the GNU C compiler... (cached) yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... (cached) none needed
    checking whether gcc understands -c and -o together... (cached) yes
    checking dependency style of gcc... (cached) none
    checking how to run the C preprocessor... gcc -E
    checking for gcc option to accept ISO C89... (cached) none needed
    checking for brew... /usr/local/bin/brew
    checking if gcc supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
    checking if gcc supports -fvisibility=hidden... yes
    checking for __int128... yes
    checking for __builtin_expect... yes
    checking for x86_64 assembly availability... no
    checking gmp.h usability... yes
    checking gmp.h presence... yes
    checking for gmp.h... yes
    checking for __gmpz_init in -lgmp... yes
    checking for CRYPTO... yes
    checking for main in -lcrypto... yes
    checking for EC functions in libcrypto... yes
    checking whether byte ordering is bigendian... no
    configure: Using assembly optimizations: no
    configure: Using field implementation: 64bit
    configure: Using bignum implementation: gmp
    configure: Using scalar implementation: 64bit
    configure: Using endomorphism optimizations: no
    configure: Building ECDSA pubkey recovery module: yes
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: error: cannot find input file: `Makefile.in'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py", line 274, in <module>
        "Topic :: Security :: Cryptography"
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Users/rjones/Projects/DVoting/env/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 563, in run
        self.run_command('build')
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
        self.run_command(cmd_name)
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py", line 194, in run
        cwd=build_temp,
      File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/libsecp256k1/configure', '--disable-shared', '--enable-static', '--disable-dependency-tracking', '--with-pic', '--enable-module-recovery', '--prefix', '/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/build/temp.macosx-10.10-x86_64-2.7']' returned non-zero exit status 1

    ----------------------------------------
Command "/Users/rjones/Projects/DVoting/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-g7qrqK-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/rjones/Projects/DVoting/env/bin/../include/site/python2.7/secp256k1" failed with error code 1 in /private/var/folders/00/vp4bg2md3ng4sqkg3hrz_j1003frjd/T/pip-build-zkoBvE/secp256k1/

:(

How to Enable ECDH?

I tried configuring secp256k1 with ./configure --enable-experimental --enable-module-ecdh and building that. Still within secp256k1-py, secp256k1.HAS_ECDH is False. What am I doing wrong?

~/projects/secp256k1-py$ SECP_BUNDLED_EXPERIMENTAL=1 INCLUDE_DIR=/usr/local/include LIB_DIR=/usr/local/lib pip install . --no-binary :all:

Deprecation warnings w/ cffi 1.8.3

/usr/local/lib/python2.7/dist-packages/secp256k1/__init__.py:228: UserWarning: implicit cast from 'char *' to a different pointer type: will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)
  self.ctx, res_compressed, outlen, self.public_key, compflag)
/usr/local/lib/python2.7/dist-packages/secp256k1/__init__.py:506: UserWarning: implicit cast from 'char *' to a different pointer type: will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)
  res = func(inst.ctx, key, scalar)

can't install secp256k1

pip3 install secp256k1
Collecting secp256k1
Using cached https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz
Requirement already satisfied: cffi>=1.3.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from secp256k1) (1.11.4)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from cffi>=1.3.0->secp256k1) (2.18)
Installing collected packages: secp256k1
Running setup.py install for secp256k1 ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-record-_rtg1xtz/install-record.txt --single-version-externally-managed --compile:
0.29.2
Using bundled libsecp256k1
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/secp256k1
copying secp256k1/init.py -> build/lib.macosx-10.9-x86_64-3.7/secp256k1
copying secp256k1/main.py -> build/lib.macosx-10.9-x86_64-3.7/secp256k1
running build_clib
Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/setup.py", line 295, in
"Topic :: Security :: Cryptography"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/setup.py", line 165, in run
cwd=absolute("libsecp256k1"),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/libsecp256k1/autogen.sh']' returned non-zero exit status 1.

----------------------------------------

Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-record-_rtg1xtz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/gp/s1z4588n7rl0v6_zkr6st3p80000gn/T/pip-install-jopw882v/secp256k1/

"pip install secp256k1" fails in python 3.7 venv on FreeBSD

Attempting to do "pip install secp256k1" in a venv on FreeBSD fails with the following error:

(jmvenv) [root@bitcoin /usr/local/bin/joinmarket]# pip install secp256k1
Collecting secp256k1
  Downloading secp256k1-0.13.2.tar.gz (156 kB)
     |████████████████████████████████| 156 kB 3.0 MB/s
Requirement already satisfied: cffi>=1.3.0 in ./jmvenv/lib/python3.7/site-packages (from secp256k1) (1.14.3)
Requirement already satisfied: pycparser in ./jmvenv/lib/python3.7/site-packages (from cffi>=1.3.0->secp256k1) (2.20)
Building wheels for collected packages: secp256k1
  Building wheel for secp256k1 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/joinmarket/jmvenv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-dz3qd2p7
       cwd: /tmp/pip-install-fk74tgtp/secp256k1/
  Complete output (24 lines):
  1.7.3
  Installed libsecp256k1 is unusable falling back to bundled version.
  Using bundled libsecp256k1
  running bdist_wheel
  The [wheel] section is deprecated. Use [bdist_wheel] instead.
  running build
  running build_py
  creating build
  creating build/lib.freebsd-12.1-RELEASE-amd64-3.7
  creating build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
  copying secp256k1/__init__.py -> build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
  copying secp256k1/__main__.py -> build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
  running build_ext
  generating cffi module 'build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c'
  creating build/temp.freebsd-12.1-RELEASE-amd64-3.7
  building '_libsecp256k1' extension
  creating build/temp.freebsd-12.1-RELEASE-amd64-3.7/build
  creating build/temp.freebsd-12.1-RELEASE-amd64-3.7/build/temp.freebsd-12.1-RELEASE-amd64-3.7
  cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -I/usr/local/include/python3.7m -c build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c -o build/temp.freebsd-12.1-RELEASE-amd64-3.7/build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.o
  build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c:569:10: fatal error: 'secp256k1.h' file not found
  #include <secp256k1.h>
           ^~~~~~~~~~~~~
  1 error generated.
  error: command 'cc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for secp256k1Running setup.py clean for secp256k1
Failed to build secp256k1
Installing collected packages: secp256k1
    Running setup.py install for secp256k1 ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/joinmarket/jmvenv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-dkf9tr57/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/bin/joinmarket/jmvenv/include/site/python3.7/secp256k1
         cwd: /tmp/pip-install-fk74tgtp/secp256k1/
    Complete output (23 lines):
    1.7.3
    Installed libsecp256k1 is unusable falling back to bundled version.
    Using bundled libsecp256k1
    running install
    running build
    running build_py
    creating build
    creating build/lib.freebsd-12.1-RELEASE-amd64-3.7
    creating build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
    copying secp256k1/__init__.py -> build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
    copying secp256k1/__main__.py -> build/lib.freebsd-12.1-RELEASE-amd64-3.7/secp256k1
    running build_ext
    generating cffi module 'build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c'
    creating build/temp.freebsd-12.1-RELEASE-amd64-3.7
    building '_libsecp256k1' extension
    creating build/temp.freebsd-12.1-RELEASE-amd64-3.7/build
    creating build/temp.freebsd-12.1-RELEASE-amd64-3.7/build/temp.freebsd-12.1-RELEASE-amd64-3.7
    cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -I/usr/local/include/python3.7m -c build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c -o build/temp.freebsd-12.1-RELEASE-amd64-3.7/build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.o
    build/temp.freebsd-12.1-RELEASE-amd64-3.7/_libsecp256k1.c:569:10: fatal error: 'secp256k1.h' file not found
    #include <secp256k1.h>
             ^~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/joinmarket/jmvenv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fk74tgtp/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-dkf9tr57/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/bin/joinmarket/jmvenv/include/site/python3.7/secp256k1 Check the logs for full command output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.