PetterS / quickjs

Thin Python wrapper of https://bellard.org/quickjs/
https://github.com/bellard/QuickJS
MIT License
175 stars 19 forks source link

pip installation failed #119

Closed Helyux closed 1 year ago

Helyux commented 2 years ago

Any Idea what i did wrong or how to solve this?`

Collecting quickjs
  Using cached quickjs-1.19.2.tar.gz (455 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for quickjs, since package 'wheel' is not installed.
Installing collected packages: quickjs
  Running setup.py install for quickjs ... error
  error: subprocess-exited-with-error

  × Running setup.py install for quickjs did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib.win32-3.10
      creating build\lib.win32-3.10\quickjs
      copying quickjs\__init__.py -> build\lib.win32-3.10\quickjs
      running build_ext
      building '_quickjs' extension
      creating build\temp.win32-3.10
      creating build\temp.win32-3.10\Release
      creating build\temp.win32-3.10\Release\upstream-quickjs
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DCONFIG_VERSION="2021-03-27" -DCONFIG_BIGNUM -IC:\Program Files (x86)\Python310-32\include -IC:\Program Files (x86)\Python310-32\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt /Tcmodule.c /Fobuild\temp.win32-3.10\Release\module.obj -Werror=incompatible-pointer-types
      cl : Befehlszeile error D8021 : Invalid Argument /Werror=incompatible-pointer-types.
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [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.
╰─> quickjs

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
qwenger commented 2 years ago

Hi,

The root cause is clear: pip is trying to build the C extension _quickjs using Microsoft Visual Studio. However, we only support compiling for Microsoft Windows using the MinGW tooling. It is a rather painful process, but we provide pre-built binaries (wheels) for Windows so that you should be able to skip it.

In your log I see

Using legacy 'setup.py install' for quickjs, since package 'wheel' is not installed.

Please try to install wheel beforehand:

pip install wheel

pip should then be able to pick the pre-built package.

SeaHOH commented 2 years ago

The reason is there has no 32-bit wheels.

qwenger commented 2 years ago

Oh yeah, right: we only provide 64bit binaries. I wonder how much sense it would make to add 32bit binaries.

SeaHOH commented 2 years ago

I wonder how much sense it would make to add 32bit binaries.

Maybe no sense. Most people could install/use 64-bit Python.

Helyux commented 2 years ago

Ahh so because there is no 32-bit binaries it tries to build but fails on building if i understood correctly? I understand that there is almost no use for 32-bit binaries but i'm currently unable to use a 64-bit version. Maybe i can try building myself, @qwenger can u elaborate on this?

compiling for Microsoft Windows using the MinGW tooling

qwenger commented 2 years ago

It's a matter of installing the winlib_mingw package (in this case the i686 version) as well as python and poetry on Windows, then running make provided by mingw.

You can check how we do it for Windows in 64bit in CI, in particular the files https://github.com/PetterS/quickjs/blob/master/.github/workflows/main.yml#L95, https://github.com/PetterS/quickjs/blob/master/.github/actions/setup-mingw/action.yml and https://github.com/PetterS/quickjs/blob/master/Makefile.

However we have no 32bit target in CI, so I'm not even sure that it compiles correctly in 32bit mode. If I get the time I'll try it in CI.

PetterS commented 1 year ago

Python possibly still links to the 32-bit installation files by default for Windows. But I think it makes little sense for this project to support Windows 32-bit.

Helyux commented 1 year ago

understandable, thanks for taking a look.