Speech Recognition. Module installed but won't work - python-3.x

Trying to get the speech recognition module to work. I have it working on my Windows 10 laptop, my Raspberry pi3 but I can't seem to get it to work on Ubuntu! The module has been install but neither PyCharm or Thonny can find it.
I've searched through stack overflow for a solution and haven't been successful. I've tried uninstalling and reinstalling the module. I've tried various versions of installing the module such as using the setuup.py file or pip, tried moving the folders/files where they should be etc..
(Also tried telling the Computer he's a good boy but that didn't work either...)
I can use this line of code
python3 -m speech_recognition
With my mic plugged into the tower and it works, but when using a line in PyCharm or Thonny such as
import speech_recognition
print(speech_recognition.__version__)
I end up with
Traceback (most recent call last):
File "/home/elitree/SPRECOG/FU.py", line 1, in <module>
import speech_recognition
ModuleNotFoundError: No module named 'speech_recognition'
python version is 3.6
pip3 version is 19.1.1
Ubuntu version is Ubuntu 18.04.2 LTS
I can provide other system details if needed
I'm just not sure what to do now

As ForceBru explained to me - My IDE was using the wrong python interpreter.
Which is first identified by running the Python script in the terminal with python3 this_file.py
After this the problem could be fixed by identifying the correct interpreter using the command which python3 in the terminal and then configuring the IDE to use that interpreter.

Related

Python, pymesh install problem on windows10

Hi I'm a Python newbie trying to program python using pymesh library but I cant get it to install properly.
Accordijng to attached image I have installed it, and the package says its for 3.8.x and I have python 3.8.2 installed.
pymesh installation instructions (https://pymesh.readthedocs.io/en/latest/installation.html) say to run a test after installing the package. The test fails.
(work) (base) D:\Downloads\HoleCutter>python -c "import pymesh; pymesh.test()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'pymesh' has no attribute 'test'
I dont have the resources/capability to 'build packages with cmake'
screen snap from command prompt window
The reason is the PyMesh library isn't kept up to date on PIP, instead you have to use Docker or compile it yourself. This problem is covered by the following issue on Github, however no action has been taken for years: https://github.com/PyMesh/PyMesh/issues/94
Have you tried "pip install pymesh" or "pipx.x install pymesh"?
I think the instructions in the link you provided are for Linux and Mac OS. You can look at this link: ImportError: No module named PyMesh

python module not found error

This question has been asked a few times, but the remedy appears to complicated enough that I'm still searching for a user specific solution.
I recently installed Quandl module using pip command. Even after successful installation my python idle is still showing
Traceback (most recent call last):
File "F:\Python36\Machine Learning\01.py", line 3, in <module>
import Quandl
ModuleNotFoundError: No module named 'Quandl'
I have used import command in my code.
I am using python 3.6.1 version.
I am working on a windows 10 Desktop.
I have also tried re-installation of module.
You can better navigate to your python scripts folder and open a command window there and try pip3 install quandl .Hope this helps.

Python 3.6 not finding modules that Python 3.5 can find

I am trying to make a discord bot based on this repository https://github.com/sleibrock/discord-bots
It uses Python 3.6, but when I try to use it I get the error
Traceback (most recent call last):
File "Bot.py", line 9, in <module>
from discord.py import Client, Game
ModuleNotFoundError: No module named 'discord'
In python3.5 >>>import discord runs fine.
In python3.6 >>>import discord gives the same error as above.
Any help would be appreciated.
edit: I copied all files from /usr/lib/python3.5/site-packages and /usr/lib64/python3.5/site-packages to the python3.6 counterparts which seems to have fixed the problem. It seems like it wasn't installing anything into the python3.6 folders and was checking the 3.5 folders, making something break with the import.
Python allows for different versions being installed independently of each other. Each one will have its own packages, which make sense because some packages require a minimal (or specific) version, and packages for Python2 could not work in Python3. In addition, packages using compiled C library will be different between 32bits and 64 bits versions.
It is a feature, because it allows you to install some packages only for one of the different versions you have on your system, but it also mean that you have to install them in all the versions you want to use with them.

How to install PyGObject on windows in a anaconda virtual env

I want to use Gtk with python under windows. I already have Anaconda installed on windows. In order not to mess up everything and to have some easiness uninstalling/reinstalling, I would like to have a virtual env created with conda, working with that Gtk installation. But I don't seems to be able to make it work.
Here is my process. I first create a raw Ananconda virtual env with
conda create -n gtk-exporter python
The virtual environment is located at C:\Anaconda3\envs\gtk-exporter.
I then download the latest windows installer for PyGObject at http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar
I extract and execute the installer and tell it to use a portable python install at C:\Anaconda3\envs\gtk-exporter. I only select Base, GTK and Glade for installation. The installation finished in a second and says it's successful.
Then within windows' shell, I activate the new environment with activate gtk-exporter. However when I try to import gtk, it fails, not finding gi.repository.
>>> from gi.repository import Gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gi'
What's wrong here ? C:\Anaconda3\envs\gtk-exporter\Lib\site-package contains a folder gnome with a lot of stuff including *.dlls, *.exe's and unix-looking folders like etc, lib or share, but I don't see a init.py or something pythonic. Am I missing a step.
Thank you for your help !
The problem was that I used python 3.5, whereas it is not supported. The installer should not have allowed me to install with python 3.5. I filed a bug report to signal it.
I solved the problem by uninstalling python 3.5 and installing python 3.4.

virtualenv can't find modules

So I had been working with virtualenvs a couple months ago but had to stop for a while and now I don't seem to be able to get it working again.
Here is what I did
D:\CS\Python_Projects\HomeCenter>venv\Scripts\activate
(venv) D:\CS\Python_Projects\HomeCenter>pip freeze
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Flask==0.10.1
Flask-SQLAlchemy==2.0
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
SQLAlchemy==1.0.8
waitress==0.8.9
Werkzeug==0.10.4
(venv) D:\CS\Python_Projects\HomeCenter>server.py
Traceback (most recent call last):
File "D:\CS\Python_Projects\HomeCenter\server.py", line 3, in <module>
from waitress import serve
ImportError: No module named 'waitress'
(venv) D:\CS\Python_Projects\HomeCenter>
Same happens if I were to run app.py, it won't find flask. I have been using PyCharm and when I check there it tells me the interpreter is pointing towards 3.4.2 virtualenv at D:\CS\Python_Projects\HomeCenter\venv
So why can't it find the modules?
Oh contents of server.py in case it's relevant
from waitress import serve
import os
from app import app
port = int(os.environ.get('PORT', 9999))
serve(app, host='0.0.0.0', port=port)
Hello I am korean student so I can't English not well. Please understand.
In my case, I have a well operated program but suddenly occured "not found" error like you after update mac os to BigSur.
but I finally found solution.
when before update I compiled by "source venv/fileName.py" but after update I compile by "python3 venv/fileName.py" then well operate
You try it too.
A couple of things could have happened here:
Use which python and which pip to check if both are from the virtual env itself.
As dirn suggested in the comments, it might be a PATH mixup. The packages were installed in the virtual environment but the script was executed from outside the environment interpreter. (Use venv\Scripts\python.exe <filename.py> instead of just filename to execute).

Resources