mozilla / libprio

INACTIVE - A C library implementing a basic version of the Prio system for private aggregation. https://crypto.stanford.edu/prio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip install prio not working on Windows

av-jeroen opened this issue · comments

Running pip install prio results in the following error on Windows: Cannot open include file: 'blapit.h'

Environment: Windows 10; Python 3.10.0; pip 21.2.3; (tried it on multiple windows-pc's). It works on Linux,

The full error:

Collecting prio
  Downloading prio-0.2.tar.gz (207 kB)
     |████████████████████████████████| 207 kB 3.3 MB/s
Using legacy 'setup.py install' for prio, since package 'wheel' is not installed.
Installing collected packages: prio
    Running setup.py install for prio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\xxxxx\test\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-install-xl6_jnan\\prio_4b0d94ba5e1c42df93abeac942cbd6b6\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-install-xl6_jnan\\prio_4b0d94ba5e1c42df93abeac942cbd6b6\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxxxx\AppData\Local\Temp\pip-record-onq_uk0h\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxx\test\venv\include\site\python3.10\prio'
         cwd: C:\Users\xxxxx\AppData\Local\Temp\pip-install-xl6_jnan\prio_4b0d94ba5e1c42df93abeac942cbd6b6\
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.10
    creating build\lib.win-amd64-3.10\prio
    copying prio\libprio.py -> build\lib.win-amd64-3.10\prio
    copying prio\prio.py -> build\lib.win-amd64-3.10\prio
    copying prio\__init__.py -> build\lib.win-amd64-3.10\prio
    running build_ext
    building '_libprio' extension
    creating build\temp.win-amd64-3.10
    creating build\temp.win-amd64-3.10\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/nspr -I/usr/include/nss -IC:\Users\xxxxx\test\venv\include -IC:\Python310\include -IC:\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tclibprio_wrap.c /Fobuild\temp.win-amd64-3.10\Release\libprio_wrap.obj
    libprio_wrap.c
    C:\Users\xxxxxr\AppData\Local\Temp\pip-install-xl6_jnan\prio_4b0d94ba5e1c42df93abeac942cbd6b6\libprio/include/mprio.h(16): fatal error C1083: Cannot open include file: 'blapit.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xxxxx\test\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-install-xl6_jnan\\prio_4b0d94ba5e1c42df93abeac942cbd6b6\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\pip-install-xl6_jnan\\prio_4b0d94ba5e1c42df93abeac942cbd6b6\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxxxx\AppData\Local\Temp\pip-record-onq_uk0h\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxx\test\venv\include\site\python3.10\prio' Check the logs for full command output.

Unfortunately, the library has a hard dependency on nss and nspr as per the setup:

libraries=["mprio", "mpi", "msgpackc", "nss3", "nspr4"],

I don't think there's an easy solution here in terms of building and distributing the package for Windows here. It might be possible to build the C-library using CMake, but it would take quite a bit of effort to port things over from scons (and that doesn't solve the Cython module either).

I'd recommend taking a look at libprio-rs which is implemented in pure Rust, and should therefore compile nicely on Windows. It has similar cryptographic semantics and should be more efficient due to some algorithmic modifications.