skip to Main Content

I am attempting to use a program that has the Python API to speech dispatcher as a dependency. The code fails on the line that imports the speech dispatcher Python interface:

import speechd

I am on Ubuntu 20 LTS, and have the speech dispatcher package installed, as well as python3-speechd. When using the python3 REPL, import speechd fails with module not found.

How can I successfully get Python to recognize the bindings for speech dispatcher?

2

Answers


  1. What tool are you using to code? (Jupyter notebook, PyCharm, etc.) I believe you need to pip install the package before you import it.

    Please try one of the below:

    !pip install speechd
    
    pip install speechd
    

    then you can run:

    import speechd
    
    Login or Signup to reply.
  2. Looks like you’re using Pyenv.

    Versions of Python installed by Pyenv do not look for packages in the system directories (/usr/lib/python3/...), that’s why installing python3-speechd does not work in your case.

    So you have two choices:

    1. Install speechd with your Pyenv version. There does not seem to be an easy way to install it, so you’d have to compile Speechd yourself first, then install the built Python package with pip.
    2. Switch to the system Python version with pyenv global system (or pyenv local system if you want it only in the current directory). Then you should be able to import speechd.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search