AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
263 stars 76 forks source link

Python.h not found on WSL Ubuntu 20.04 installation #79

Closed zetsuboii closed 2 years ago

zetsuboii commented 2 years ago

Hey, I was trying to install the package but I get an error saying that it couldn't find Python.h while installing. I'm using Ubuntu 20 on WSL and I've installed gcc python-dev libgmp3-dev before both installing the package using pip3 & installing directly from the source.

Also my Python version is 3.8, if it's useful

Here's the full log

> sudo python3 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 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/benchmark.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/ecdsa.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/point.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/curve.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/util.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/keys.py -> build/lib.linux-x86_64-3.8/fastecdsa
copying fastecdsa/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa
creating build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_prehashed.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_key_export_import.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_prime_field_curve_math.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_point.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests
copying fastecdsa/tests/test_whycheproof_vectors.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_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_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/__init__.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/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/der.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/pem.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
copying fastecdsa/encoding/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa/encoding
creating build/lib.linux-x86_64-3.8/fastecdsa/tests/encoding
copying fastecdsa/tests/encoding/test_der.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests/encoding
copying fastecdsa/tests/encoding/test_sec1.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests/encoding
copying fastecdsa/tests/encoding/__init__.py -> build/lib.linux-x86_64-3.8/fastecdsa/tests/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
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc/ -I/usr/include/python3.8 -c src/curveMath.c -o build/temp.linux-x86_64-3.8/src/curveMath.o -O2
In file included from src/curveMath.c:1:
src/curveMath.h:4:10: fatal error: Python.h: No such file or directory
    4 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Have a good day and thanks for your time

zetsuboii commented 2 years ago

Turns out problem was not about this specific package but the fact that I haven't installed python3.8-dev dependency. Didn't know each version had its own dev package.