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

unable to install on WSL ubuntu #230

Open
ShaneKosieradzki opened this issue Feb 20, 2024 · 0 comments
Open

unable to install on WSL ubuntu #230

ShaneKosieradzki opened this issue Feb 20, 2024 · 0 comments
Labels

Comments

@ShaneKosieradzki
Copy link

ShaneKosieradzki commented Feb 20, 2024

Setup:

  • OS: WSL Ubuntu
  • Python: 3.10.6
  • C compiler version: GCC 11.3.0
  • Pyfhel Version: 3.4.2

shane@MaxQ:~$ pip install Pyfhel
Defaulting to user installation because normal site-packages is not writeable
Collecting Pyfhel
Using cached Pyfhel-3.4.2.tar.gz (1.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [499 lines of output]

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  ctypedef unsigned long long uint64_t

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport istream, ostream, ifstream, ofstream, ostringstream, stringstream, binary

  from Pyfhel.Afhel.Afhel cimport *
  ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:21:0: 'Pyfhel/Afhel/Afhel.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import Plaintext class, original from SEAL
  from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
  ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/AfPtxt.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import Plaintext class, original from SEAL
  from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
  ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/AfsealPtxt.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import Plaintext class, original from SEAL
  from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
  ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/scheme_t.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import Plaintext class, original from SEAL
  from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
  ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/backend_t.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t

  # ------------------------------- DECLARATION ---------------------------------

  cdef class PyPtxt:
      cdef AfPtxt* _ptr_ptxt
          ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:21:9: 'AfPtxt' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # ------------------------------- DECLARATION ---------------------------------

  cdef class PyPtxt:
      cdef AfPtxt* _ptr_ptxt
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
          ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:23:9: 'scheme_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  cdef class PyPtxt:
      cdef AfPtxt* _ptr_ptxt
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
          ^
  ------------------------------------------------------------

  Pyfhel/PyPtxt.pxd:24:9: 'backend_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import AfsealPoly class
  from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
  ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/AfPoly.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import AfsealPoly class
  from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
  ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/AfsealPoly.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # Import our own wrapper for iostream classes, used for I/O ops
  from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

  # Import AfsealPoly class
  from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
  ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/cy_complex.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex

  # ------------------------------- DECLARATION ---------------------------------

  cdef class PyPoly:
      cdef AfsealPoly* _afpoly
          ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:22:9: 'AfsealPoly' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # ------------------------------- DECLARATION ---------------------------------

  cdef class PyPoly:
      cdef AfsealPoly* _afpoly
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
          ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:24:9: 'scheme_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  cdef class PyPoly:
      cdef AfsealPoly* _afpoly
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
          ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:25:9: 'backend_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef class PyPoly:
      cdef AfsealPoly* _afpoly
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
      cpdef vector[cy_complex] to_coeff_list(self)
                            ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:26:27: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cdef AfsealPoly* _afpoly
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
      cpdef vector[cy_complex] to_coeff_list(self)
      cpdef cy_complex get_coeff(self, size_t i)
           ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:27:10: 'cy_complex' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
      cpdef vector[cy_complex] to_coeff_list(self)
      cpdef cy_complex get_coeff(self, size_t i)
      cpdef void set_coeff(self, cy_complex&val, size_t i)
                                ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:28:31: 'cy_complex' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cdef backend_t _backend
      cpdef vector[cy_complex] to_coeff_list(self)
      cpdef cy_complex get_coeff(self, size_t i)
      cpdef void set_coeff(self, cy_complex&val, size_t i)
      cpdef void check_afpoly(self)
      cpdef void from_coeff_list(self, vector[cy_complex] coeff_list, PyCtxt ref)
                                                       ^
  ------------------------------------------------------------

  Pyfhel/PyPoly.pxd:30:54: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from Pyfhel.PyCtxt cimport PyCtxt
  from Pyfhel.PyPoly cimport PyPoly

  # ---------------------------- CYTHON DECLARATION ------------------------------
  cdef class Pyfhel:
      cdef Afhel* afseal           # The C++ methods are accessed via a pointer
          ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:30:9: 'Afhel' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cpdef bool batchEnabled(self)
      cpdef size_t get_nSlots(self)
      cpdef vector[uint64_t] get_qi(self)
      cpdef uint64_t get_plain_modulus(self)
      cpdef size_t get_poly_modulus_degree(self)
      cpdef scheme_t get_scheme(self)
           ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:178:10: 'scheme_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

      # ============================ POLYNOMIAL =================================
      cpdef PyPoly empty_poly(self, PyCtxt ref)
      cpdef PyPoly poly_from_ciphertext(self, PyCtxt ctxt, size_t i)
      cpdef PyPoly poly_from_plaintext(self, PyCtxt ref, PyPtxt ptxt)
      cpdef PyPoly poly_from_coeff_vector(self, vector[cy_complex] coeff_vector, PyCtxt ref)
                                                                ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:190:63: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef void _read_cy_attributes(Pyfhel he, istream& istr)

  cpdef np.ndarray[dtype=np.int64_t, ndim=1] vec_to_array_i(vector[int64_t] vec)
  cpdef np.ndarray[dtype=np.uint64_t, ndim=1] vec_to_array_u(vector[uint64_t] vec)
  cpdef np.ndarray[dtype=double, ndim=1] vec_to_array_f(vector[double] vec)
  cdef shared_ptr[AfsealCtxt] _dyn_c(shared_ptr[AfCtxt] c)                         ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:211:26: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef void _read_cy_attributes(Pyfhel he, istream& istr)

  cpdef np.ndarray[dtype=np.int64_t, ndim=1] vec_to_array_i(vector[int64_t] vec)
  cpdef np.ndarray[dtype=np.uint64_t, ndim=1] vec_to_array_u(vector[uint64_t] vec)
  cpdef np.ndarray[dtype=double, ndim=1] vec_to_array_f(vector[double] vec)
  cdef shared_ptr[AfsealCtxt] _dyn_c(shared_ptr[AfCtxt] c)                                                   ^
  ------------------------------------------------------------

  Pyfhel/Pyfhel.pxd:211:52: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # Import Abstract Ciphertext class
  from Pyfhel.Afhel.Afhel cimport *

  # ---------------------------- CYTHON DECLARATION ------------------------------
  cdef class PyCtxt:
      cdef shared_ptr[AfCtxt] _ptr_ctxt
                           ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pxd:22:26: unknown type in template argument

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  # ---------------------------- CYTHON DECLARATION ------------------------------
  cdef class PyCtxt:
      cdef shared_ptr[AfCtxt] _ptr_ctxt
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
          ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pxd:24:9: 'scheme_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # ---------------------------- CYTHON DECLARATION ------------------------------
  cdef class PyCtxt:
      cdef shared_ptr[AfCtxt] _ptr_ctxt
      cdef Pyfhel _pyfhel
      cdef scheme_t _scheme
      cdef backend_t _backend
          ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pxd:25:9: 'backend_t' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
                    Pyfhel pyfhel=None,
                    fileName=None,
                    bytestring=None,
                    scheme=None):
          self._mod_level = 0
          self._scheme = scheme_t.none
                        ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:31:23: undeclared name not builtin: scheme_t

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
                    bytestring=None,
                    scheme=None):
          self._mod_level = 0
          self._scheme = scheme_t.none
          if copy_ctxt: # If there is a PyCtxt to copy, override other args
              self._ptr_ctxt = make_shared[AfsealCtxt](deref(dyn_cast[AfsealCtxt,AfCtxt](copy_ctxt._ptr_ctxt)))
                                          ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:33:41: not parsable as a type

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
                    bytestring=None,
                    scheme=None):
          self._mod_level = 0
          self._scheme = scheme_t.none
          if copy_ctxt: # If there is a PyCtxt to copy, override other args
              self._ptr_ctxt = make_shared[AfsealCtxt](deref(dyn_cast[AfsealCtxt,AfCtxt](copy_ctxt._ptr_ctxt)))
                                                                     ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:33:68: not parsable as a type

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
              self._scheme = copy_ctxt._scheme
              if (copy_ctxt._pyfhel):
                  self._pyfhel = copy_ctxt._pyfhel

          else:
              self._ptr_ctxt = make_shared[AfsealCtxt]()
                                          ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:40:41: not parsable as a type

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          cdef string bFileName = _to_valid_file_str(fileName).encode('utf8')
          cdef string bcompr_mode = compr_mode.lower().encode('utf8')
          outputter = new ofstream(bFileName, binary)
          try:
              size = self._pyfhel.afseal.save_ciphertext(
                  deref(outputter), bcompr_mode, deref(self._ptr_ctxt))
                 ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:227:16: Cannot convert 'ofstream' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          """
          if self._pyfhel is None:
              raise ValueError("<Pyfhel ERROR> ciphertext serializing requires a Pyfhel instance")
          cdef ostringstream outputter
          cdef string bcompr_mode = compr_mode.encode('utf8')
          self._pyfhel.afseal.save_ciphertext(outputter, bcompr_mode, deref(self._ptr_ctxt))
                                             ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:247:44: Cannot convert 'ostringstream' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          cdef size_t size
          cdef string bFileName = _to_valid_file_str(fileName, check=True).encode('utf8')
          inputter = new ifstream(bFileName, binary)
          try:
              size = self._pyfhel.afseal.load_ciphertext(
                  deref(inputter), deref(self._ptr_ctxt))
                 ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:277:16: Cannot convert 'ifstream' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          """
          if self._pyfhel is None:
              raise ValueError("<Pyfhel ERROR> ciphertext loading requires a Pyfhel instance")
          cdef stringstream inputter
          inputter.write(content,len(content))
          self._pyfhel.afseal.load_ciphertext(inputter, deref(self._ptr_ctxt))
                                             ^
  ------------------------------------------------------------

  Pyfhel/PyCtxt.pyx:306:44: Cannot convert 'stringstream' to Python object
  Compiling Pyfhel/Pyfhel.pyx because it changed.
  Compiling Pyfhel/PyCtxt.pyx because it changed.
  Compiling Pyfhel/PyPtxt.pyx because it changed.
  Compiling Pyfhel/PyPoly.pyx because it changed.
  [1/4] Cythonizing Pyfhel/PyCtxt.pyx
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
      self.run_setup()
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 649, in <module>
      ext_modules=cythonize(
    File "/usr/lib/python3/dist-packages/Cython/Build/Dependencies.py", line 1127, in cythonize
      cythonize_one(*args)
    File "/usr/lib/python3/dist-packages/Cython/Build/Dependencies.py", line 1250, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: Pyfhel/PyCtxt.pyx
  [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

No branches or pull requests

1 participant