ModuleNotFoundError: No module named 'speech_recognition' - Linux - python-3.x

I am trying to install speech_recognition on Manjaro GNU/Linux x86_64 for Python 3.8 by using the following commands:
conda install -c conda-forge speechrecognition
And
pip3 install --upgrade speechrecognition
"conda list" command shows the following packages to be installed (amongst others):
portaudio, pyaudio, python_abi, readline, speechrecognition
However, when I try to import it:
import speech_recognition as st
It gives me the error:
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call
last) in
----> 1 import speech_recognition as st
ModuleNotFoundError: No module named 'speech_recognition'
How to fix this?
Thanks
SOLVED with:
conda install -c conda-forge jupyterlab

Related

Python - import cv2 after installation vidgear

I installed RasPiOS Bullseye OS in my Raspberry Pi zero, with Python 3.9.2.
I installed opencv with
sudo apt install python3-opencv -y
I test import cv2 and it works. Then I installed vidgear with pip3 install vidgear .
I test import cv2 and not works:
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
Traceback (most recent call last):
File "", line 1, in
ImportError: numpy.core.multiarray failed to import
Numpy version is 1.19.5. The same version that was there before installing vidgear.
I tried pip3 uninstall numpy and pip3 install numpy==1.19.5 , but don't work, same error.
Can you help me, please?
thank you,

Python doesn't find modules

I've installed Python3 and PyQt5, but i cant run anything because it says Python can't find module:
python3 GUI.py
Traceback (most recent call last):
File "/home/victor/Documentos/Work_Programming/Python/GUI.py", line 10, in <module>
from PyQt5 import QtCore, QtGui, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'
however i've installed correctly PyQt5, if i try to re-install it, it shows me this:
Requirement already satisfied: PyQt5 in /usr/lib/python3/dist-packages (5.14.1)
How can i make my python find modules?
My Operative System is Ubuntu 20.04.5 LTS
Try sudo apt-get install python3-pyqt5
If it didn't work try:
apt-get install python3-venv
python3 -m venv .venv
source .venv/bin/activate
sudo apt-get install python3-pyqt5
and re-install all your requirements and it must work

Imported module was not found?

I am building a web scraper and I am trying to import the 'requests' package but I am getting an error. I am being told the following:
ModuleNotFoundError: No module named 'requests'
Full Error:
(venv) USERs-MacBook-Pro:Scraper user$ /usr/local/opt/python#3.9/bin/python3.9 /Users/user/git/ML/Python/Practice/Scraper/Scraper.py
Traceback (most recent call last):
File "/Users/user/git/ML/Python/Practice/Scraper/Scraper.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Steps I took when setting up project:
python3 -m venv project_name/venv
source project_name/venv/bin/activate
python3 -m pip install SomePackage
Confirmation package and dependences were installed:
(venv) USERs-MacBook-Pro:Scraper user$ pip list
Package Version
---------- ---------
certifi 2020.12.5
chardet 4.0.0
idna 2.10
pip 20.2.3
requests 2.25.1
setuptools 49.2.1
urllib3 1.26.2
By using the absolute path to system Python like that:
/usr/local/opt/python#3.9/bin/python3.9 /Users/user/git/ML/Python/Practice/Scraper/Scraper.py
you are using system's Python 3.9 and the packages that are installed for that one although you are in a virtual environment.
When creating a virtual environment you are creating a separate environment with the specified python version and all the packages you install with pip are installed to this environment and this python version.
You can better understand that if you run:
which python
inside your virtual environment.
This will show you the python that is used when you run python inside your venv and it's going to be different than
/usr/local/opt/python#3.9/bin/python3.9
So, by having installed requests using pip inside your environment, it is installed in the environments python which is executed when you run just python.
To sum up, to use the packages installed inside your venv with pip you should run your script (after activating the venv) with:
python /Users/user/git/ML/Python/Practice/Scraper/Scraper.py

How to import in python 3?

I am self-learning Python and all the online courses use labs where all libraries are already imported. Whenever I try to import numpy or pandas or any other library I receive this message:
"Traceback (most recent call last):
File "<pyshell#6>", line 1, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'"
What am I doing wrong?
import-error-no-module-named-numpy
ModuleNotFoundError is thrown when a module could not be found
Support for Python 3 was added in NumPy version 1.5.0
you do not install numpy Correctly
pip uninstall numpy
pip3 install numpy
I strongly recommend you use Virtualenv to install it numpy
pip install virtualenv
go to folder of your code use
virtualenv venv
//Windows
venv\Scripts\activate
//Linux
source venv/bin/activate
you can use conda to install numpy
download conda from here coda GUI installer
Best practice, use an environment rather than install in the base env
conda create -n my-env
conda activate my-env
If you want to install from conda-forge
conda config --env --add channels conda-forge
The actual install command
conda install numpy

Import Simpy in Python 3

I am unable to import simpy in Python 3. It gives me this error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-076c1059698e> in <module>
----> 1 import simpy
ModuleNotFoundError: No module named 'simpy'
Please tell me a way to do so?
Make sure the package is installed and available in your environment, as that is a common error when the package is not present.
Run:
pip install simpy
or if you have separate Python versions on your system:
pip3 install simpy
Or, if installing from the source code:
python setup.py install
or,
python3 setup.py install

Resources