rustpq / pqcrypto

Rust Post-Quantum cryptography
212 stars 38 forks source link

Installation fails with pip #41

Closed mouse07410 closed 2 years ago

mouse07410 commented 2 years ago
$ sudo -EH pip install pqcrypto
Enter PIN for 'Certificate For PIV Authentication': 
Collecting pqcrypto
  Downloading pqcrypto-0.1.3.tar.gz (1.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 19.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cffi<2.0.0,>=1.14.2
  Downloading cffi-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl (178 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.9/178.9 kB 7.6 MB/s eta 0:00:00
Requirement already satisfied: pycparser in /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cffi<2.0.0,>=1.14.2->pqcrypto) (2.21)
Building wheels for collected packages: pqcrypto
  Building wheel for pqcrypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pqcrypto (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      A setup.py file already exists. Using it.
      Traceback (most recent call last):
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-install-b2kuhf7r/pqcrypto_82dc7e3f926a4b61851d5ecee25e43f6/setup.py", line 2, in <module>
          from setuptools import setup
      ModuleNotFoundError: No module named 'setuptools'
      Traceback (most recent call last):
        File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-build-env-uxvwleqe/overlay/lib/python3.10/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
          return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-build-env-uxvwleqe/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 78, in make_in
          wb.build()
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-build-env-uxvwleqe/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 110, in build
          self._build(zip_file)
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-build-env-uxvwleqe/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 162, in _build
          self._run_build_command(setup)
        File "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-build-env-uxvwleqe/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 190, in _run_build_command
          subprocess.check_call(
        File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10', '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-install-b2kuhf7r/pqcrypto_82dc7e3f926a4b61851d5ecee25e43f6/setup.py', 'build', '-b', '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/pip-install-b2kuhf7r/pqcrypto_82dc7e3f926a4b61851d5ecee25e43f6/build']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pqcrypto
Failed to build pqcrypto
ERROR: Could not build wheels for pqcrypto, which is required to install pyproject.toml-based projects

MacOS 12.4, Xcode-13.4.1, Python-3.10.

Must add that cloning this repo and building locally - succeeded, but the Wheel file is nowhere to be found:

$ poetry build
Creating virtualenv pqcrypto-l7v69cZ0-py3.10 in /Users/ur20980/Library/Caches/pypoetry/virtualenvs
Building pqcrypto (0.1.3)
  - Building sdist
  - Built pqcrypto-0.1.3.tar.gz
  - Building wheel
/Users/ur20980/Library/Caches/pypoetry/virtualenvs/pqcrypto-l7v69cZ0-py3.10/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
running build
running build_py
creating /Users/ur20980/src/pqcrypto/build
creating /Users/ur20980/src/pqcrypto/build/lib.macosx-12.0-x86_64-cpython-310
creating /Users/ur20980/src/pqcrypto/build/lib.macosx-12.0-x86_64-cpython-310/pqcrypto
copying pqcrypto/__init__.py -> /Users/ur20980/src/pqcrypto/build/lib.macosx-12.0-x86_64-cpython-310/pqcrypto
copying pqcrypto/common.py -> /Users/ur20980/src/pqcrypto/build/lib.macosx-12.0-x86_64-cpython-310/pqcrypto
package init file 'pqcrypto/kem/__init__.py' not found (or not a regular file)
.  .  .
clang -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -O3 -std=gnu18 -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/pqcrypto._sign.sphincs_shake256_256s_simple.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/common/aes.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/common/fips202.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/common/randombytes.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/common/sha2.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/common/sp800-185.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/address.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/fors.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/hash_shake256.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/sign.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/thash_shake256_simple.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/utils.o /Users/ur20980/src/pqcrypto/build/temp.macosx-12.0-x86_64-cpython-310/Users/ur20980/src/pqcrypto/sources/sphincs-shake256-256s-simple/ref/wots.o -o /Users/ur20980/src/pqcrypto/build/lib.macosx-12.0-x86_64-cpython-310/pqcrypto/_sign/sphincs_shake256_256s_simple.abi3.so
  - Built pqcrypto-0.1.3-cp310-cp310-macosx_12_0_x86_64.whl
$

But the tests cannot find pqcrypto wheel:

$ python tests/test_kem.py 
Traceback (most recent call last):
  File "/Users/ur20980/src/pqcrypto/tests/test_kem.py", line 4, in <module>
    import pqcrypto.kem
ModuleNotFoundError: No module named 'pqcrypto'
$
mouse07410 commented 2 years ago

The answer (maybe obvious for some) turned out to be

dist/pqcrypto-0.1.3-cp310-cp310-macosx_12_0_x86_64.whl
thomwiggers commented 2 years ago

As I was on vacation the past weeks I could not get to this sooner.

This is a set of Rust crates, why were you trying pip?

mouse07410 commented 2 years ago

You are correct - I reported this (valid) problem to the wrong repository. It should've gone to https://github.com/kpdemetriou/pqcrypto.git