Skip to content
Advertisement

Python Modules installing properly but dont exist in editors

I want to start with I am new to the python language and am learning on my own. My issue is that I am installing the modules that I’m trying to use. The installs are successful but do not exist when I try to import them. I am using Visual Studio Code, Python 3.6, and Anaconda on Windows 10.

I am trying to use pyttsx3, SpeechRecognition and pocketsphinx.

    $pip list

This gives me a very large list but does not contain either of my installed modules.

    $python -m pip list

Gives me smaller output with them.

Package           Version
----------------- ---------
beautifulsoup4    4.6.0
bs4               0.0.1
certifi           2018.4.16
chardet           3.0.4
click             6.7
gTTS              2.0.0
gTTS-token        1.1.1
idna              2.6
pip               10.0.1
pocketsphinx      0.1.3 #Here
pypiwin32         223
pyttsx            1.1
pyttsx3           2.7 #Here
pywin32           223
requests          2.18.4
setuptools        39.1.0
six               1.11.0
SpeechRecognition 3.8.1 #Here
urllib3           1.22
wheel             0.31.0

I know their installed but when I try to use any of the imports.

$python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyttsx3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyttsx3'

I am fine with this being something small on my part due to my lack of knowledge with this language, but I have done a full days worth of research trying to solve this myself.

Edit:

$pip --version
pip 9.0.1 from C:UsersKeiroAnaconda3libsite-packages (python 3.6)

Advertisement

Answer

You have two versions of pip perhaps two different installations of python as well. One with Anaconda and other one by main site.

Stick to one version and if you install in that use that environment in Visual Studio(Or VS Code)

You have installed those in anaconda which the standard installtion of Python wont recognize..

Open Python prompt from Anaconda Navigator >> Choose the environment (Select base for default) >> Open with Terminal [Or Open with Python]

>>python
>>import pyttsx3

In Visual Studio code set the same environment

Ctrl+Shift+P >> Select Python interpreter

Choose the anaconda location.

Volla. Now it should work

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement