Python - import cv2 after installation vidgear - python-3.x

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,

Related

ModuleNotFoundError: No module named 'speech_recognition' - Linux

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

Issue with importing Seaborn

When I try to import seaborn the import give me the below error message:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import seaborn
ModuleNotFoundError: No module named 'seaborn'
I have tried the below steps to install:
pip install seaborn
python -m pip install seaborn
!conda install seaborn
%%bash pip install seaborn
pip3 install seaborn
conda install seaborn
sudo pip install utils ...and then install seaborn again
pip uninstall scipy and then install scipy package again.
These are the solutions I found, I closed iTerm and started it again and none of these worked.
Make sure you have Python and pip installed on your computer. Reinstall it if you have it. Try pip install seaborn. Also, make sure you are installing it in the same directory as where you are working. If that issue still persists, there must be a problem with your shell or computer.
PS:
If you are using Juypter Notebook do in a cell:
import sys
!{sys.executable} -m pip install seaborn

How can I install modules in Mac OS Terminal?

I want to install some modules for Telegram Bots and I always get errors like:
File "test.py", line 7, in <module>
import spotipy
ModuleNotFoundError: No module named 'spotipy'
I tried to install spotipy with pip, pip3 and apt.
How is it done? Or generally how do I import modules?
Thank you.
From the spotipy README:
If you already have Python on your system you can install the library simply by downloading the distribution, unpack it and install in the usual fashion:
python setup.py install
You can also install it using a popular package manager with
pip install spotipy
or
easy_install spotipy
Make sure your pip version matches your python version (pip --version and python --version should both be Python3 or Python2).
To import the module, use one of the following statements (see python3 documentation):
import numpy
import numpy as np
from numpy import array

When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'

I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.

numpy intalled with pip but not found (in virtualenv)

In an AWS EC2 instance, with Amazon Linux AMI 2016.09 distribution, I have installed numpy, inside my virtualenv where python 3.4 is the default version, with:
pip install numpy
It installs package numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl without errors.
After that, in python I try to import it:
>>> import numpy
And I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
Moreover, if I run pip freeze, numpy does not appear in the list.
Why is numpy not being found? and How to fix it?
Did you do this:
#:source .venv/bin/activate
.....
#:python
....
>>>pip3 install numpy
....
This works!

Resources