ibarrond / Pyfhel

PYthon For Homomorphic Encryption Libraries, perform encrypted computations such as sum, mult, scalar product or matrix multiplication in Python, with NumPy compatibility. Uses SEAL/PALISADE as backends, implemented using Cython.
https://pyfhel.readthedocs.io/
Apache License 2.0
469 stars 78 forks source link

Installation error #108

Closed LaiaAuset closed 2 years ago

LaiaAuset commented 2 years ago

Description The installation of the new version for Pyfhel-CKKS (pip install Pyfhel==3.0.0b3) does not work.

Setup:

Error message image

ibarrond commented 2 years ago

Weird! I cannot reproduce the error. In an almost empty environment I get: image

I'll have to try with Python 3.9 just to be sure. What is even weirder is that the version 3.0.0b3 is listed among the available versions. Can you check with pip install Pyfhel==3.0.0b2? Oh, and just in case, can you update pip to the latest version?

LaiaAuset commented 2 years ago

Gives the same error. Already with the latest version of pip

ibarrond commented 2 years ago

Is that the full error message? I have the feeling I'm missing something

LaiaAuset commented 2 years ago

This is the full error message

*******************************************************************************************************************
Collecting Pyfhel==3.0.0b2
  Using cached Pyfhel-3.0.0b2.tar.gz (41.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' 'C:\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip\_vendor\pep517\in_process\_in_process.py' get_requires_for_build_wheel 'C:\\AppData\Local\Temp\tmpogodqx4l'
       cwd: C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793
  Complete output (53 lines):
  Compiling C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\Pyfhel.pyx because it depends on C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\Cython\Includes\libcpp\vector.pxd.
  Compiling C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyCtxt.pyx because it depends on C:\Users\\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\Cython\Includes\libcpp\vector.pxd.
  Compiling C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyPtxt.pyx because it depends on C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\Cython\Includes\libcpp\vector.pxd.
  Compiling C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyPoly.pyx because it depends on C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\Cython\Includes\libcpp\vector.pxd.
  [1/4] Cythonizing C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyCtxt.pyx
  [2/4] Cythonizing C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyPoly.pyx
  [3/4] Cythonizing C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\PyPtxt.pyx
  [4/4] Cythonizing C:\\AppData\Local\Temp\pip-install-dndr5tvn\pyfhel_b66aaca0cd0544e582056915d00e9793\Pyfhel\Pyfhel.pyx
  running egg_info
  writing Pyfhel.egg-info\PKG-INFO
  writing dependency_links to Pyfhel.egg-info\dependency_links.txt
  writing requirements to Pyfhel.egg-info\requires.txt
  writing top-level names to Pyfhel.egg-info\top_level.txt
  cimporting numpy version '1.21.4'
  reading manifest file 'Pyfhel.egg-info\SOURCES.txt'
  Traceback (most recent call last):
    File "C:\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
      main()
    File "C:\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 13    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 299, in run
      self.find_sources()
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 306, in find_sources
      mm.run()
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 541, in run
      self.add_defaults()
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 585, in add_defaults
      self.read_manifest()
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\sdist.py", line 195, in read_manifest
      self.filelist.append(line)
    File "C:\\AppData\Local\Temp\pip-build-env-468s3l0i\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 483, in append
      path = convert_path(item)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\distutils\util.py", line 123, in convert_path
      raise ValueError("path '%s' cannot be absolute" % pathname)
  ValueError: path '/make/rast/Documents/Pyfhel/Pyfhel/PyCtxt.cpp' cannot be absolute
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/10/d9/118bf363f9cfcc6c5a3b6b17d6247420e95942df6dacd55ce81d5c358a3d/Pyfhel-3.0.0b2.tar.gz#sha256=4ec59ff4aa765545383e152b763d190a3f91f65f4c667d2ab7469147e03b8f3d (from https://pypi.org/simple/pyfhel/) (requires-python:>=3.7). Command errored out with exit status 1: 'C:\\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' 'C:\\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip\_vendor\pep517\in_process\_in_process.py' get_requires_for_build_wheel 'C:\\AppData\Local\Temp\tmpogodqx4l' Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement Pyfhel==3.0.0b2 (from versions: 2.0.0a2, 2.0.0a3, 2.0.0a4, 2.0.0a5, 2.0.1, 2.0.2rc1, 2.0.3, 2.0.4, 2.1.0, 2.2.0, 2.2.1, 2.2.3, 2.2.4, 2.2.5, 2.3.1, 3.0.0b1, 3.0.0b2, 3.0.0b3)
ERROR: No matching distribution found for Pyfhel==3.0.0b2
*********************************************************************************************************

Thank you!

leonardo-delfino commented 2 years ago

Same error with Python 3.10.1 using pip, pip3 or from Pycharm (that also uses pip).

leonardo-delfino commented 2 years ago

Same error with Python 3.10.1

I will add a bit to it. I tried to git clone (following the instructions of the repo) and then build it using Python3.10.1. I got an issue while cloning:

remote: Enumerating objects: 358, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 358 (delta 7), reused 23 (delta 7), pack-reused 331
Receiving objects: 100% (358/358), 519.59 KiB | 4.64 MiB/s, done.
Resolving deltas: 100% (172/172), done.
Cloning into 'C:/Users/user/Pyfhel/Pyfhel/PALISADE'...
fatal: unable to access 'https://git.njit.edu/palisade/PALISADE/': Failed to connect to git.njit.edu port 443: Timed out

fatal: clone of 'https://git.njit.edu/palisade/PALISADE' into submodule path 'C:/Users/user/Pyfhel/Pyfhel/PALISADE' failed
Failed to clone 'Pyfhel/PALISADE' a second time, aborting

Executing the command python3 setup.py build returns, of course, an error.

So, I noticed that both the SEAL and HElib folders were empty. I manually cloned the HElib and the SEAL repositories into their respective directories, and tried to execute python3 setup.py build.

Now, after running python3 setup.py build again, (I already had Microsoft Visual C++ >=14.0. If you don't have it installed, it will cause an error) it compiled the library successfully. After that I also tried to import Pyfhel and everything seems to work.

ShokofehVS commented 2 years ago

ready had Microsoft Visual C++ >=14.0.

I have a similar issue while installing Pyfhel on Linux (i.e., fatal: unable to access 'https://git.njit.edu/palisade/PALISADE/' and SEAL and HElib folders were empty).

coderhard commented 2 years ago

For the palisade REPO... you can try replacing the call to git.njit.edu with the following https://gitlab.com/palisade/palisade-release.git I haven't figured out how to solve the missing SEAL part yet

On Thu, Jan 27, 2022 at 9:45 AM ShokofehVS @.***> wrote:

ready had Microsoft Visual C++ >=14.0.

I have a similar issue while installing Pyfhel on Linux (i.e., fatal: unable to access 'https://git.njit.edu/palisade/PALISADE/' and SEAL and HElib folders were empty).

— Reply to this email directly, view it on GitHub https://github.com/ibarrond/Pyfhel/issues/108#issuecomment-1023352516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAMLUSFETNUA5GIOM3OSD3UYFSATANCNFSM5IE7C36Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

coderhard commented 2 years ago

I think @ibarrond said you need to switch to the DEV branch... not the main branch. That is where all of the fixes appear to be.

On Thu, Jan 27, 2022 at 11:55 PM Hassan Karim @.***> wrote:

For the palisade REPO... you can try replacing the call to git.njit.edu with the following https://gitlab.com/palisade/palisade-release.git I haven't figured out how to solve the missing SEAL part yet

On Thu, Jan 27, 2022 at 9:45 AM ShokofehVS @.***> wrote:

ready had Microsoft Visual C++ >=14.0.

I have a similar issue while installing Pyfhel on Linux (i.e., fatal: unable to access 'https://git.njit.edu/palisade/PALISADE/' and SEAL and HElib folders were empty).

— Reply to this email directly, view it on GitHub https://github.com/ibarrond/Pyfhel/issues/108#issuecomment-1023352516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAMLUSFETNUA5GIOM3OSD3UYFSATANCNFSM5IE7C36Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Sincerely,

Hassan Karim Thoughts in motion

ShokofehVS commented 2 years ago

I think @ibarrond said you need to switch to the DEV branch... not the main branch. That is where all of the fixes appear to be. On Thu, Jan 27, 2022 at 11:55 PM Hassan Karim @.> wrote: For the palisade REPO... you can try replacing the call to git.njit.edu with the following https://gitlab.com/palisade/palisade-release.git I haven't figured out how to solve the missing SEAL part yet On Thu, Jan 27, 2022 at 9:45 AM ShokofehVS @.> wrote: > ready had Microsoft Visual C++ >=14.0. > > I have a similar issue while installing Pyfhel on Linux (i.e., fatal: > unable to access 'https://git.njit.edu/palisade/PALISADE/' and SEAL and > HElib folders were empty). > > — > Reply to this email directly, view it on GitHub > <#108 (comment)>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/AGAMLUSFETNUA5GIOM3OSD3UYFSATANCNFSM5IE7C36Q > . > Triage notifications on the go with GitHub Mobile for iOS > https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 > or Android > https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. > > You are receiving this because you are subscribed to this thread.Message > ID: @.***> > -- Sincerely, Hassan Karim Thoughts in motion

I tried to reach the DEV branch but my issue has remained on Windows 10, Python 3.10, Pyfhel 3.0.1 and MSVC 14.29.30133:

ERROR: Command errored out with exit status 1: command: 'C:\Users\User\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' build_wheel 'C:\Users\User\AppData\Local\Temp\tmps5ci_qqn'

ERROR: Failed building wheel for Pyfhel Failed to build Pyfhel ERROR: Could not build wheels for Pyfhel, which is required to install pyproject.toml-based projects

ibarrond commented 2 years ago

Took quite a while, but hopefully Pyfhel==3.1 solves this! I've been coding and running the latest demos in Windows, so I have high hopes it will work!

ShokofehVS commented 2 years ago

Took quite a while, but hopefully Pyfhel==3.1.1 solves this! I've been coding and running the latest demos in Windows, so I have high hopes it will work!

Would it possibly work on branching and conditional statements as well?

ibarrond commented 2 years ago

@ShokofehVS You would need comparison for both branching and conditional statements, but it is not currently implemented in the Pyfhel backend. Your best choice is to use a different type of FHE scheme named TFHE. I suggest you to take a look at concrete

ShokofehVS commented 2 years ago

Yes exactly, I understand that TFHE works well on Comparison, however, I used Pyfhel entirely on my machine learning algorithms now only comparison statements are missing to be encrypted. Besides, there is no proper implementation of TFHE in Python. Would you mind suggesting one that can come along with Pyfhel?

ibarrond commented 2 years ago

Have a look at concrete-ml!

ibarrond commented 2 years ago

Closing, since the Pyfhel==3.1 version now installs correctly both in Windows and Linux!