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

bug: Doesn't work on installing on Windows #86

Open
DE-ZIX opened this issue Mar 30, 2023 · 23 comments
Open

bug: Doesn't work on installing on Windows #86

DE-ZIX opened this issue Mar 30, 2023 · 23 comments
Labels
bug Something isn't working

Comments

@DE-ZIX
Copy link

DE-ZIX commented Mar 30, 2023

Describe the bug

Trying to use this port on windows.

I tried building it on windows as well in many ways but all of them leading to errors with dead ends so problems for another time.

I used it on WSL2 ubuntu environment in the same machine following the same steps and it works. So the problem is most certainly the OS.

To reproduce

  1. Installed on windows with pip install whispercpp, it says that the installation is successful
  2. when running a code that imports the library, the following error happens:

Error: None (reason: No module named 'whispercpp.api_cpp2py_export')

when running this line of code

Whisper.from_pretrained(params.model, './models')

Expected behavior

For the package to be usable on windows

Environment

python 3.9.3
Windows 11

@DE-ZIX DE-ZIX added the bug Something isn't working label Mar 30, 2023
@aarnphm
Copy link
Owner

aarnphm commented Mar 31, 2023

I have not tested on windows. can you try pip install git+https://github.com/aarnphm/whispercpp.git?

@DE-ZIX
Copy link
Author

DE-ZIX commented Mar 31, 2023

I tried that as well, I aslo tried building it on windows using either blazer o pip. Neither work. I tried both using the blazer.exe available inside ./tools folder and installing blazer manually.

Here's what I get with pip install git+https://github.com/aarnphm/whispercpp.git

Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/aarnphm/whispercpp.git
  Cloning https://github.com/aarnphm/whispercpp.git to c:\users\de-zix\appdata\local\temp\pip-req-build-3fkswne0
  Running command git clone --filter=blob:none --quiet https://github.com/aarnphm/whispercpp.git 'C:\Users\DE-ZIX\AppData\Local\Temp\pip-req-build-3fkswne0'
  hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead
  hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"
  Resolved https://github.com/aarnphm/whispercpp.git to commit 584cb4c46dda0e93ed3001eb4188c31e3a9edfdf
  Running command git submodule update --init --recursive -q
  hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead
  hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: whispercpp
  Building wheel for whispercpp (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for whispercpp (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      C:\Users\DE-ZIX\AppData\Local\Temp\pip-build-env-co_nhid8\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
        warnings.warn(msg, _BetaConfiguration)
      running bdist_wheel
      hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead
      hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"
      hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead
      hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"
      Building pybind11 extension...
      error: [WinError 193] %1 is not a valid Win32 application
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for whispercpp
Failed to build whispercpp
ERROR: Could not build wheels for whispercpp, which is required to install pyproject.toml-based projects

@aarnphm
Copy link
Owner

aarnphm commented Apr 1, 2023

I see. I don't have access tih Windows machine atm to test this out. But I think it might have to do with bazel setup on Windows.

@bryceamacker
Copy link

Has anyone been able to get past this? It's almost definitely from the bazel project building api_cpp2py_export and audio_cpp2py_export as so regardless of the target platform, but I haven't worked with bazel enough to know how to fix it for Windows.

@aarnphm
Copy link
Owner

aarnphm commented Apr 17, 2023

Windows is not supported atm. Suggest to use WSL to run Linux

@DoodleBears
Copy link

Has anyone been able to get past this? It's almost definitely from the bazel project building api_cpp2py_export and audio_cpp2py_export as so regardless of the target platform, but I haven't worked with bazel enough to know how to fix it for Windows.

same issue, and I try pywhispercpp on my windows, it works

@EricKong1985
Copy link

C:\Users\Administrator\AppData\Local\Temp\pip-build-env-zjk3e4_2\overlay\Lib\site-packages\setuptools\config\pyprojecttoml.py:66: _BetaConfiguration: Support for [tool.setuptools] in pyproject.toml is still beta.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running bdist_wheel
Building pybind11 extension...
error: [WinError 193] %1 不是有效的 Win32 应用程序。
error: subprocess-exited-with-error

× Building wheel for whispercpp (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'C:\Python310\python.exe' 'C:\Python310\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py' build_wheel 'C:\Users\Administrator\AppData\Local\Temp\tmpqb8acivp'
cwd: C:\Users\Administrator\AppData\Local\Temp\pip-req-build-kszf4fqx
Building wheel for whispercpp (pyproject.toml) ... error
ERROR: Failed building wheel for whispercpp
Failed to build whispercpp
ERROR: Could not build wheels for whispercpp, which is required to install pyproject.toml-based projects

@EricKong1985
Copy link

Failed to build whispercpp
ERROR: Could not build wheels for whispercpp, which is required to install pyproject.toml-based projects
Exception information:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\pip_internal\cli\base_command.py", line 169, in exc_logging_wrapper
status = run_func(*args)
File "C:\Python310\lib\site-packages\pip_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
File "C:\Python310\lib\site-packages\pip_internal\commands\install.py", line 426, in run
raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for whispercpp, which is required to install pyproject.toml-based projects
Remote version of pip: 23.1.2
Local version of pip: 23.1.2
Was pip installed by pip? True
Removed build tracker: 'C:\Users\Administrator\AppData\Local\Temp\pip-build-tracker-_w9sifk1'

@EricKong1985
Copy link

any one success built in windows?

@EricKong1985
Copy link

Windows is not supported atm. Suggest to use WSL to run Linux

so it means ,there will be no way to use lib in windows?

@NSuer
Copy link

NSuer commented Jun 21, 2023

Is there any update on this? Would someone be able to jump on a call so we can try to fix this together? I would do it myself but don't have knowledge on the repository. In my opinion incompatibility with Windows is a big problem.

@aarnphm
Copy link
Owner

aarnphm commented Jun 22, 2023

We can jump on a call, but I currently don't have a windows box setup.

@NSuer
Copy link

NSuer commented Jun 22, 2023

Would you be able to meet up tomorrow or this weekend? I'm in EST time

@aarnphm
Copy link
Owner

aarnphm commented Jun 22, 2023

Sure, I'm also on EST

@NSuer
Copy link

NSuer commented Jun 22, 2023

Should I message you on something else, so we don't just spam this issue?

@aarnphm
Copy link
Owner

aarnphm commented Jun 23, 2023

yes feel free to shoot me a email

@amish1706
Copy link

Is there any update on this? Is it possible to run this on windows?

@codethazine
Copy link

Any updates on the issue? It still doesn’t work on windows

@podraco
Copy link

podraco commented Jan 17, 2024

we should find how to break the issue in minor tasks, for now, we know that the .so files are not valid win32 files, that, for some reason are built within the package.

then, once we have the bidnings, make the automated test to ensure that this project doesn't break in the future.

then update the files and enable new users to build within setup.py or the newest python standard pytoml definitions. etc.

@podraco
Copy link

podraco commented Jan 17, 2024

can we review where are the commands defined to build each dll/so files?

@podraco
Copy link

podraco commented Jan 17, 2024

the current bazel script won't work, since the mirrors doesn't show any mirror for bazel 6.0.0, we should update the script to use 7.0.0, since it's the latest version, and will be maintained for at least 6 months

image

@podraco
Copy link

podraco commented Jan 17, 2024

This is a script based on the bash file, also, you should change $WHISPER.CPP.PY/tools/bazel to $WHISPER.CPP.PY/tools/bazel.sh

Keep in mind this file requires .bazelversion to be set to 6.1.1 to work and to be honest, it's not the best script for these needs.

$ErrorActionPreference = "Stop"
$requiredVersion = [Version]"7.0"
$currentVersion = $PSVersionTable.PSVersion

if ($currentVersion -lt $requiredVersion) {
    Write-Error "This script requires PowerShell version $requiredVersion or later. Please upgrade PowerShell."
    exit 1
}

# courtesy of https://github.com/grpc/grpc
$ScriptDir = (Get-Item -Path $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty DirectoryName)
$GitRoot = (& git rev-parse --show-toplevel).Trim()

if (-not (Test-Path "$GitRoot/requirements/bazel-pypi.lock.txt")) {
    New-Item -ItemType File "$GitRoot/requirements/bazel-pypi.lock.txt" | Out-Null
}

# DISABLE_BAZEL_WRAPPER can be set to eliminate the wrapper logic
if ($env:DISABLE_BAZEL_WRAPPER -ne "" -and $env:OVERRIDE_BAZEL_VERSION -eq "") {
    Write-Output "DEBUG: DISABLE_BAZEL_WRAPPER=$env:DISABLE_BAZEL_WRAPPER"
    Write-Output "INFO: Starting process 'bazel' with arguments [$args]"
    if ($env:BAZEL_REAL -ne "") {
        # use BAZEL_REAL as set by
        # https://github.com/bazelbuild/bazel/blob/master/scripts/packages/bazel.sh
        # that originally invoked this script (this is what happens when you
        # run "bazel" in our workspace)
        Write-Output "DEBUG: Executing command: '$env:BAZEL_REAL $args'" 
        Start-Process -FilePath "$env:BAZEL_REAL" -ArgumentList $args -PassThru | ForEach-Object { $_.WaitForExit() }
    }
    else {
        # if BAZEL_REAL is not set, just invoke the default system bazel
        Write-Output "DEBUG: Executing command: 'bazel $args'" 
        Start-Process -FilePath "bazel" -ArgumentList $args -PassThru | ForEach-Object { $_.WaitForExit() }
    }
}

# $VERSION = $env:OVERRIDE_BAZEL_VERSION ?? (Get-Content "$ScriptDir/../.bazelversion" | ForEach-Object { $_.Trim() })
if (-not [string]::IsNullOrWhiteSpace($env:OVERRIDE_BAZEL_VERSION)) {
    $VERSION = $env:OVERRIDE_BAZEL_VERSION
} else {
    $VERSION = (Get-Content "$ScriptDir/../.bazelversion" | ForEach-Object { $_.Trim() })
}


Write-Output "INFO: Bazel version set to $VERSION." 

Write-Output "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." 

$BaseURLMirror = "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/bazel/releases/download"
$BaseURL = "https://github.com/bazelbuild/bazel/releases/download"

# bazel binary will be downloaded to GIT_ROOT/tools directory by default
$DownloadDir = $env:OVERRIDE_BAZEL_WRAPPER_DOWNLOAD_DIR ?? $ScriptDir

switch ($Env:OS, $Env:PROCESSOR_ARCHITECTURE) {
    {"Linux", "x86_64"} {
        $Suffix = "linux-x86_64"
    }
    {"Linux", "aarch64"} {
        $Suffix = "linux-arm64"
    }
    {"Darwin", "x86_64"} {
        $Suffix = "darwin-x86_64"
    }
    {"Darwin", "arm64"} {
        $Suffix = "darwin-arm64"
    }
    {"Windows_NT", "AMD64"}{
        $Suffix = "windows-x86_64.exe"
    }
    {"MINGW*", "MSYS_NT"} {
        $Suffix = "windows-x86_64.exe"
    }
    default {
        Write-Error "Unsupported architecture: $Env:OS $($Env:PROCESSOR_ARCHITECTURE)"
        exit 1
    }
}

$Filename = "bazel-$VERSION-$Suffix"
$FilenameAbs = Join-Path $DownloadDir $Filename

if (-not (Test-Path $FilenameAbs -PathType Leaf) -or -not (Test-Path $FilenameAbs -PathType Leaf)) {
    # first try to download using mirror, fallback to download from github
    Write-Output "Downloading bazel, will try URLs: $BaseURLMirror/$VERSION/$Filename $BaseURL/$VERSION/$Filename"
    Invoke-WebRequest -Uri "$BaseURLMirror/$VERSION/$Filename" -OutFile $FilenameAbs -ErrorAction Stop
    Set-ItemProperty -Path $FilenameAbs -Name IsReadOnly -Value $false
}
Write-Output "Starting process bazel [$FilenameAbs] with arguments [$args]" 
Write-Output "Executing command: '$FilenameAbs $args'" 
Start-Process -FilePath $FilenameAbs -ArgumentList $args -PassThru | ForEach-Object { $_.WaitForExit() }

This script requires version 7 from powershell, otherwise it might fail due to some expressions introduced in later versions.

@podraco
Copy link

podraco commented Jan 17, 2024

the documentation should add that anaconda is required to compile binaries using bezel!!!!

which is annoying. as far as i looked in the build file, it seems to require python_abi, a package that's only available in anaconda. i'm still not sure what does python_abi do, but it's required for bazel :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants