tink-crypto / tink

Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
https://developers.google.com/tink
Apache License 2.0
13.47k stars 1.18k forks source link

Tink installation fails on MacOs / Windows #637

Closed basilboli closed 1 year ago

basilboli commented 1 year ago

Help us help you

Hi ,
We’re using tink library with python program.

When installing tink package on MacOs or Windows tink will build from sources using Bazel and will fail with error:

      Analyzing: target //tink/cc/pybind:tink_bindings (1 packages loaded, 0 targets configured)
      ERROR: /private/var/folders/hw/tgf58bq50ts3wxl8pw3y29r40000gn/T/pip-install-cvt_9dny/tink_db349fc9269a434d97f1fdff40fddab2/tink/cc/pybind/BUILD.bazel:343:22: no such package '@tink_cc//integration/gcpkms': Package is considered deleted due to --deleted_packages and referenced by '//tink/cc/pybind:[tink_bindings.so](http://tink_bindings.so/)'
      ERROR: Analysis of target '//tink/cc/pybind:tink_bindings' failed; build aborted:
      INFO: Elapsed time: 19.548s
      INFO: 0 processes.
      FAILED: Build did NOT complete successfully (35 packages loaded, 137 targets configured)
      FAILED: Build did NOT complete successfully (35 packages loaded, 137 targets configured)
      error: command '/usr/local/bin/bazel' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> tink

We don’t use / import gcpkms nor awskms features from tink in our program. How can we add those bindings so we can compile it ? Can we build tink without gcpkms and awskms features ?

Installing tink package on Linux works OK as it’s doesn’t compile from sources with Bazel.

What sort of feature would you like to see?

We expect installing tink library on Windows / MacOs to work.

Have you considered any alternative solutions? No

Would you like to add additional context? Tink version 1.6.1 MacOs Version 12.2.1 Python 3.8.3

morambro commented 1 year ago

Unfortunately as of 1.6.1 (but also with 1.7.0) we create a unique .so for tink_cc and its extensions for Tink Python to use. This won't change in the near future. Also, currently we don't support Windows.

Could you please share the command you've used to install, and the Bazel version? Also, could you please give it a try with v1.7.0?

I'll take a look at this and try to reproduce it in the meantime.

basilboli commented 1 year ago

Thank you for quick answer. Finally, it worked with python 3.8.14 installed with homebrew.

How I solved the problem:

  1. Removed Python 3.8.3 installation installed with Python installer from https://www.python.org/downloads
  2. Installed Python 3.8.14 with homebrew
  3. Reinstalled bazel with bazelisk

Seems like with Python 3.8.3 on MacOs 12.2.1 pip was not able to download tink-1.6.1-2-cp38-cp38-macosx_11_0_x86_64.whl. When I tried installing it directly I had:

ERROR: tink-1.6.1-cp38-cp38-macosx_11_0_x86_64.whl is not a supported wheel on this platform.

With Python 3.8.14 it's working.

morambro commented 1 year ago

Great! Thanks for sharing how you solved it :) I am going to close this issue, feel free to reopen it if you have any other questions/concerns.