cmusphinx / pocketsphinx

A small speech recognizer
Other
3.9k stars 714 forks source link

"metadata-generation-failed" error preventing install #290

Closed mattordev closed 1 year ago

mattordev commented 2 years ago

Trying to use pip to install and keep running into this error:

PS G:\GitRepos\coda> pip install --upgrade pocketsphinx
Collecting pocketsphinx
  Downloading pocketsphinx-0.1.15.tar.gz (29.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 29.1/29.1 MB 3.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\matto\AppData\Local\Temp\pip-install-32ut6re5\pocketsphinx_a40dbd22250f45afb7bad2f3d614e2f0\setup.py", line 20, in <module>
          from distutils.command.bdist_msi import bdist_msi as _bdist_msi
      ModuleNotFoundError: No module named 'distutils.command.bdist_msi'
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Running python version 3.8.3, pip 22.2.2, setuptools-65.3.0 and wheel-0.37.1. Windows 10 Pro 21H2

Any help is massively appreciated!

dhdaines commented 2 years ago

Oh! Interesting. It looks like setuptools is trying to generate a Microsoft Installer (MSI) package. I didn't even know it could do that... I'm really not sure why it is trying to do that... and apparently that is deprecated since Python 3.9: https://docs.python.org/3/distutils/builtdist.html

This seems to be the scourge of Python packaging which is incompatible and unreliable versions of setuptools vs. wheel. vs. pip vs. spam vs. eggs...

This could be something in the pocketsphinx-python package which is, sadly, external to PocketSphinx itself and has its own issue tracker at https://github.com/bambocher/pocketsphinx-python/issues though I think it is not maintained.

mattordev commented 2 years ago

I've seen pocketsphinx-python, sadly it's not maintained by the looks of it, no.

I ended up getting around this issue through a friend, who when building using CMake failed, resorted to just sending me the lib from their machine which is somewhere it did successfully install on.

I think part of the issue comes down to the ambiguity of pocketsphinx5 and pocketsphinx-python, but I know that reintegrating them has already been mentioned in #269. From what we found out, doing pip install pocketsphinx will install pocketsphinx-python and not pocketsphinx5 - although, we were trying for so long to find a solution my memory is a little cloudy about it so I'm not 100 percent certain - I'll get her to clarify with me and post here :)

As I mentioned in #269, I'm looking at using pocketsphinx for offline voice processing, but I've learned today that the speech recognition library from Uberi uses the defunct pocketsphinx-python... which now gives me another issue entirely

dhdaines commented 2 years ago

Yes ... I'm starting the process to get the pocketsphinx name back (there is also pocketsphinx2, pocketsphinx-fork and who knows what else...)

The pocketsphinx5 module doesn't yet support the exact same API as pocketsphinx-python, but it won't be hard to do. I just released it to PyPI and there is a wheel for Windows there (in fact they are built automatically by GitHub actions on checkin, so it should always work).

mattordev commented 2 years ago

Just checked that out, really good to see that the wheel is built. Not sure if there's one based on arm processors yet but I'm sure one will come eventually. As for speech recognition library from Uberi using the old version, I might have to raise an issue on their end to get them to switch over to this much more feature rich and stable version of pocketsphinx.

dhdaines commented 2 years ago

Hi, I've made a new pre-release which reclaims the "pocketsphinx" name and is available on PyPI. Because it's a pre-release you need the --pre flag to pip to install it, which is a good thing, because...

... there is a tiny problem with it which prevents it working with Uberi speech_recognition: https://github.com/cmusphinx/pocketsphinx/issues/294

To avoid any possible confusion I won't redo the release just for this, as there may be some other compatibility issues, but if you want to try installing from source (also possible with pip) you can try it...

mattordev commented 2 years ago

Really glad to see that it should eventually work with Uberi's speech recog. I'll give it an install, and might make a couple of scripts to learn how to mess around with it properly so will report back if I run into anything that I can't find a solution for.

Thank you for the continual updates!

mattordev commented 2 years ago

I thought there might have to be some work on Uberi's side to make Speech recog work, is that not the case? I'm not 100% sure on how it's implemented

dhdaines commented 2 years ago

Just a tiny change, they were using an internal module that wasn't meant to be used directly:

https://github.com/Uberi/speech_recognition/pull/622

mattordev commented 2 years ago

Ah I see! Going to follow it closely. Hopefully it should be a quick one

dhdaines commented 1 year ago

This should all be fixed since https://github.com/cmusphinx/pocketsphinx/releases/tag/v5.0.0rc4 - and you can get it from PyPI by passing the --pre flag to pip, e.g.:

pip install --pre pocketsphinx