Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

benchmark command doesn't work #44

Closed
tomato42 opened this issue Dec 2, 2019 · 2 comments
Closed

benchmark command doesn't work #44

tomato42 opened this issue Dec 2, 2019 · 2 comments

Comments

@tomato42
Copy link

tomato42 commented Dec 2, 2019

I cannot run the benchmark command on Python 3.8:

tomato@bursa22(pts/19)$ virtualenv3 -p `which python3` venv-py3
Running virtualenv with interpreter /bin/python3
Using base prefix '/usr'
New python executable in /home/tomato/workspace/fastecdsa/venv-py3/bin/python3
Also creating executable in /home/tomato/workspace/fastecdsa/venv-py3/bin/python
Installing setuptools, pip, wheel...
done.
$ :) [22:18:09] ~/workspace/fastecdsa 
tomato@bursa22(pts/19)$ ls
docs  fastecdsa  LICENSE  MANIFEST.in  README.rst  setup.py  src  venv-py3
$ :) [22:18:15] ~/workspace/fastecdsa 
tomato@bursa22(pts/19)$ ./venv-py3/bin/python setup.py install
running install
running bdist_egg
running egg_info
creating fastecdsa.egg-info
writing fastecdsa.egg-info/PKG-INFO
writing dependency_links to fastecdsa.egg-info/dependency_links.txt
writing requirements to fastecdsa.egg-info/requires.txt
writing top-level names to fastecdsa.egg-info/top_level.txt
writing manifest file 'fastecdsa.egg-info/SOURCES.txt'
reading manifest file 'fastecdsa.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'fastecdsa.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/curve.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/ecdsa.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/benchmark.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/keys.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/util.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/point.py -> build/lib.linux-x86_64-3.8/fastecdsa
creating build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_prime_field_curve_math.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_signature_encoding.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_nonce_generation.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_brainpool_ecdh.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_asn1.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_key_encoding.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_p256_ecdsa.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_rfc6979_ecdsa.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_key_recovery.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_keygen.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_whitespace_parsing.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
creating build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/der.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/sec1.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/asn1.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/util.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/pem.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
running build_ext
building 'fastecdsa.curvemath' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/curveMath.c -o build/temp.linux-x86_64-3.8/src/curveMath.o -O2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/curve.c -o build/temp.linux-x86_64-3.8/src/curve.o -O2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/point.c -o build/temp.linux-x86_64-3.8/src/point.o -O2
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/src/curveMath.o build/temp.linux-x86_64-3.8/src/curve.o build/temp.linux-x86_64-3.8/src/point.o -L/usr/lib -lgmp -o build/lib.linux-x86_64-3.8/fastecdsa/curvemath.cpython-38-x86_64-linux-gnu.so
building 'fastecdsa._ecdsa' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/_ecdsa.c -o build/temp.linux-x86_64-3.8/src/_ecdsa.o -O2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/curveMath.c -o build/temp.linux-x86_64-3.8/src/curveMath.o -O2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/curve.c -o build/temp.linux-x86_64-3.8/src/curve.o -O2
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Isrc/ -I/usr/include/python3.8 -c src/point.c -o build/temp.linux-x86_64-3.8/src/point.o -O2
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/src/_ecdsa.o build/temp.linux-x86_64-3.8/src/curveMath.o build/temp.linux-x86_64-3.8/src/curve.o build/temp.linux-x86_64-3.8/src/point.o -L/usr/lib -lgmp -o build/lib.linux-x86_64-3.8/fastecdsa/_ecdsa.cpython-38-x86_64-linux-gnu.so
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/curve.py -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/curvemath.cpython-38-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/__init__.py -> build/bdist.linux-x86_64/egg/fastecdsa
creating build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_prime_field_curve_math.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/__init__.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_signature_encoding.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_nonce_generation.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_brainpool_ecdh.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_asn1.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_key_encoding.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_p256_ecdsa.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_rfc6979_ecdsa.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_key_recovery.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_keygen.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/tests/test_whitespace_parsing.py -> build/bdist.linux-x86_64/egg/fastecdsa/tests
copying build/lib.linux-x86_64-3.8/fastecdsa/_ecdsa.cpython-38-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/ecdsa.py -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/benchmark.py -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/keys.py -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/util.py -> build/bdist.linux-x86_64/egg/fastecdsa
copying build/lib.linux-x86_64-3.8/fastecdsa/point.py -> build/bdist.linux-x86_64/egg/fastecdsa
creating build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/der.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/__init__.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/sec1.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/asn1.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/util.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
copying build/lib.linux-x86_64-3.8/fastecdsa/encoding/pem.py -> build/bdist.linux-x86_64/egg/fastecdsa/encoding
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/curve.py to curve.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_prime_field_curve_math.py to test_prime_field_curve_math.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_signature_encoding.py to test_signature_encoding.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_nonce_generation.py to test_nonce_generation.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_brainpool_ecdh.py to test_brainpool_ecdh.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_asn1.py to test_asn1.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_key_encoding.py to test_key_encoding.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_p256_ecdsa.py to test_p256_ecdsa.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_rfc6979_ecdsa.py to test_rfc6979_ecdsa.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_key_recovery.py to test_key_recovery.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_keygen.py to test_keygen.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/tests/test_whitespace_parsing.py to test_whitespace_parsing.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/ecdsa.py to ecdsa.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/benchmark.py to benchmark.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/keys.py to keys.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/util.py to util.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/point.py to point.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/der.py to der.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/sec1.py to sec1.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/asn1.py to asn1.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/util.py to util.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/encoding/pem.py to pem.cpython-38.pyc
creating stub loader for fastecdsa/curvemath.cpython-38-x86_64-linux-gnu.so
creating stub loader for fastecdsa/_ecdsa.cpython-38-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/curvemath.py to curvemath.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/fastecdsa/_ecdsa.py to _ecdsa.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying fastecdsa.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying fastecdsa.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying fastecdsa.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying fastecdsa.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying fastecdsa.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
fastecdsa.__pycache__._ecdsa.cpython-38: module references __file__
fastecdsa.__pycache__.curvemath.cpython-38: module references __file__
creating dist
creating 'dist/fastecdsa-1.7.5-py3.8-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing fastecdsa-1.7.5-py3.8-linux-x86_64.egg
creating /home/tomato/workspace/fastecdsa/venv-py3/lib/python3.8/site-packages/fastecdsa-1.7.5-py3.8-linux-x86_64.egg
Extracting fastecdsa-1.7.5-py3.8-linux-x86_64.egg to /home/tomato/workspace/fastecdsa/venv-py3/lib/python3.8/site-packages
Adding fastecdsa 1.7.5 to easy-install.pth file

Installed /home/tomato/workspace/fastecdsa/venv-py3/lib/python3.8/site-packages/fastecdsa-1.7.5-py3.8-linux-x86_64.egg
Processing dependencies for fastecdsa==1.7.5
Searching for six
Reading https://pypi.org/simple/six/
Downloading https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl#sha256=1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd
Best match: six 1.13.0
Processing six-1.13.0-py2.py3-none-any.whl
Installing six-1.13.0-py2.py3-none-any.whl to /home/tomato/workspace/fastecdsa/venv-py3/lib/python3.8/site-packages
Adding six 1.13.0 to easy-install.pth file

Installed /home/tomato/workspace/fastecdsa/venv-py3/lib/python3.8/site-packages/six-1.13.0-py3.8.egg
Finished processing dependencies for fastecdsa==1.7.5
$ :) [22:18:28] ~/workspace/fastecdsa 
tomato@bursa22(pts/19)$ ./venv-py3/bin/python setup.py benchmark
running benchmark
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/tomato/workspace/fastecdsa/fastecdsa/benchmark.py", line 10, in <module>
    from .ecdsa import sign, verify
  File "/home/tomato/workspace/fastecdsa/fastecdsa/ecdsa.py", line 4, in <module>
    from fastecdsa import _ecdsa
ImportError: cannot import name '_ecdsa' from 'fastecdsa' (/home/tomato/workspace/fastecdsa/fastecdsa/__init__.py)
@AntonKueltz
Copy link
Owner

Good catch, the following command would be need in order for the shared objects to be in the package folder -

python setup.py build_ext --inplace

Otherwise the shared objects just get built and sent to the build/ folder. I'll update the command to do this implicitly, that way a fresh clone of the repo should be able to run the benchmark right away without requiring any other commands.

@AntonKueltz
Copy link
Owner

Fixed in 089e6a1 (included in release v2.0.0).

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

No branches or pull requests

2 participants