user9889742
user9889742

Reputation: 21

KeyError: '__version__' installing openai-whisper on Python 3.13

Getting this error when I try to download Whisper Python version 3.13 - I wasted a lot of time figuring out the problem - can anyone help? I even tried reverting to a lower version but didn't help.

Collecting openai-whisper
  Using cached openai-whisper-20240930.tar.gz (800 kB)
  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
  ╰─> [25 lines of output]
      <string>:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Traceback (most recent call last):
        File "/Users/pinjalim/Dropbox/Projects/Transcripto/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "/Users/pinjalim/Dropbox/Projects/Transcripto/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/pinjalim/Dropbox/Projects/Transcripto/.venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/q5/r66rvlp92fn06jqmhpg3zbwm0000gn/T/pip-build-env-jhoypdd0/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/q5/r66rvlp92fn06jqmhpg3zbwm0000gn/T/pip-build-env-jhoypdd0/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/private/var/folders/q5/r66rvlp92fn06jqmhpg3zbwm0000gn/T/pip-build-env-jhoypdd0/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 521, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/q5/r66rvlp92fn06jqmhpg3zbwm0000gn/T/pip-build-env-jhoypdd0/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 21, in <module>
        File "<string>", line 11, in read_version
      KeyError: '__version__'
      [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.

Upvotes: 1

Views: 3573

Answers (4)

Nahid Hasan
Nahid Hasan

Reputation: 1

I ran into the same issue using uv. Seems like whisper doesn't support 3.13 yet. So you need to downgrade your python environment to 3.11.9.

You can do this using uv by doing the following steps, if you already have a uv venv:

  • Delete the .venv directory from your project directory
  • Edit the pyproject.toml to have requires-python = ">=3.11"
  • Edit the .python_version with 3.11.9 (This is important, otherwise uv pip will use the pip from this python env instead of .venv's pip)

Upvotes: 0

user29261136
user29261136

Reputation: 1

Seems like you have this figured out but for anyone reading in the future: Whispers supports python 3.9-3.11, so using 3.13 will result in this same error of inability building the wheel. If you run into this issue, downgrade to 3.11 in your environment for a clean and contained fix.

Upvotes: 0

Manasvi Sareen
Manasvi Sareen

Reputation: 956

Downgrading python to 3.11.9 worked. As per the OpenAI Whisper documentation they only support till version 3.11.9

Upvotes: 2

Charles Duffy
Charles Duffy

Reputation: 295688

The specific bug this question was asked about is fixed by the as-yet-unmerged PR openai/whisper#2409.

However, as of the date when that PR was filed, numba didn't support Python 3.13 either; because whisper depends on numba, this means that even with the setup.py / version.py issue corrected, one still cannot use whisper with Python 3.13.

As of present date, numba support for Python 3.13 merged to numba main three days ago; however, this is not yet included in any published release: the latest release of numba is from mid-June, and does not contain this fix.

Consequently, as of today, whisper cannot be used on Python 3.13 using only released, supported versions of its dependency chain.

Upvotes: 2

Related Questions