Python 3.6 ModuleNotFoundError: No module named 'pyttsx3'
Asked Answered
V

5

6

I have absolutely no idea what can be the problem. I did the pip installer (pip install pyttsx3) and re-installed the JetBrains PyCharm, but it still not working.

Vigil answered 21/8, 2018 at 12:40 Comment(5)
It depends on which version of Python your Pycharm is set and on which version of Python you installed the module. Go to File -> Settings -> Project:.. -> Project Interpreter and check which version of Python you run on the project. Then go to the CMD/ terminal and write pip -V and it will tell you the pip version and the Python one. Might be different version.Calyptra
Yes, the pip version is different. In Pycharm it is 10.0.1, and the other is 18.0. So how can I fix it? How can I upgrade the pip inside Pycharm?Vigil
Wasn't talking about pip itself but rather about the Python version. At the end of pip -V it should write the Python version. To upgrade pip you can use pip install --upgrade pip.Calyptra
If I am reading it correctly, the the python version is 3.6 in Pycharm and in the cmd. So it is the sameVigil
Hmm, you might have multiple of the same interpreter. When you install Pycharm you have the option to also install Python. Check if you have multiple of the same Python in File -> Settings -> Project:.. -> Project Interpreter. Click on the arrow at "Python Interpreter". If you only have one then try to first reinstall the package using pip install --upgrade --force-reinstall pyttsx3. If none of these work then I suggest to try and install the package on Pycharm itself by clicking on the green plus sign at the project interpreter window.Calyptra
T
2

Start a pyCharm terminal window, then install 'pipenv' which is an improved pip replacement as follows: pip install -u pipenv Then use pipenv instead of pip as this will create it's own Pipfile and virtualenv. You can install pyttsx3 as follows: pipenv install pyttsx3 This will create a Pipfile and a Pipfile.lock which pycharm should pickup and ensure it's using the correct python version and virtualenv environment. Otherwise check that your python interpreter is set correctly in "Run/Debug configurations". If it's not in that list then you can add a new python interpreter via the Preferences->Project->Project Interpreter option.

Thereinto answered 21/8, 2018 at 23:12 Comment(0)
O
2

Well i might be a little late but incase anyone is still having problem, i managed to fix it with py -m pip install pyttsx3

Outpoint answered 22/12, 2020 at 15:17 Comment(0)
C
1

Here a solution on my mac with BigSur OS, maybe because i have a mixed configuration

so i try pip3 install pyttsx3 and instales but checkin in different place:

when import fails throwing an error. So i decided to go on and i found where the pip3 installed the pkgs:

check if is installed:

python3 -m pyttsx3                        
/Applications/Xcode.app/Contents/Developer/usr/bin/python3: No module named pyttsx3

python -m pyttsx3 
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pyttsx3

pip3 install pyttsx3

first check where is a previus version:

ls -lstr /Users/paul/Library/Python/3.7/lib/python/site-packages
...
 0 drwxr-xr-x   8 paul  staff     256 Mar  2 01:52 pyobjc-7.1.dist-info
  0 drwxr-xr-x   9 paul  staff     288 Mar  2 01:52 pyttsx3
  0 drwxr-xr-x   9 paul  staff     288 Mar  2 01:52 pyttsx3-2.90.dist-info
  0 drwxr-xr-x  17 paul  staff     544 Mar  2 02:44 urllib3
  0 drwxr-xr-x   8 paul  staff     256 Mar  2 02:44 urllib3-1.26.3.dist-info
  0 drwxr-xr-x   9 paul  staff     288 Mar  2 02:44 soupsieve
  0 drwxr-xr-x   8 paul  staff     256 Mar  2 02:44 soupsieve-2.2.dist-info
  8 -rw-r--r--   1 paul  staff     544 Mar  2 02:44 rubicon_
...



python3 --version
Python 3.8.2

check the path of the pkg on your system with:

python -m pyttsx3

Then you just have to copy to the path where you need to use the package.

sudo cp -r /Users/paul/Library/Python/3.7/lib/python/site-packages/pyttsx3/ /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages

sudo cp -r /Users/paul/Library/Python/3.7/lib/python/site-packages/pyttsx3-2.90.dist-info /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages

regards

Calliecalligraphy answered 3/3, 2021 at 20:37 Comment(0)
M
1

I had the same issue.

All I did is used 'python <filename>' to run the program instead of 'python3 <filename>' and it WORKED.

I am not sure, but maybe pyttsx3 does not support the python3 syntax to find itself.

I hope this helps anyone out there, who searched for hours just like me.

Measurement answered 19/9, 2021 at 4:56 Comment(0)
K
0

If you're using Python 3 then use

pip3 install pyttsx3
Kudu answered 11/10, 2020 at 6:18 Comment(1)
Welcome to SO! If you're intending to answer to old question (this one is over 2 year old): Please check if the question already has an accepted answer (that's the case here). If so, please only answer if you really have a substantial improvement to offer.S

© 2022 - 2024 — McMap. All rights reserved.