No matter what I install, it's either opencv-python, opencv-contrib-python or both at the same time, I keep getting the "No module named 'cv2'" error. I couldn't find an answer here. Some say that only opencv-python works, others say opencv-contrib-python works. I tried everything but nothing seems to work. I'm trying to use the aruco function and I know it belongs to the contrib module.
Any tip? Thanks
Did you try to restart your code editor? I often need to close the file or whole VScoode and reopen for it to see the library I just installed.
Another problem could be that you're installing cv2 to a python verse that youre not using on your code editor..
If youre using python2.9 on your code editor but you install cv2 on your terminal with "pip3.10 install opencv-python" command, your code editor wont find it
I would recommend using conda and creating a new enviroment. Then try sudo pip3 install opencv-python if youre using python3 or you can try sudo pip install opencv-python if you're using python2. This worked for me.
Another tip is to always check that you have the newest version of pip pip install --upgrade pip
Related
I have a very basic question. I want to install a new module on my computer in order to use it in Python (via Spyder). When I install the package via pip everything seems to work fine. When I want to import the package in my script it says that there is no module by that name (see scrennshot below)
Any suggestions what might be the problem?
Thanks a lot :)
screenshot of this problem
You're using pip3 to install.
Try installing using pip install nibabel.
Failing that, I would refer you to the following question:
Which pip is with which python?
This is a common pitfall of using different versions of Python and pip.
I think
/Applications/Spyder.app/Contents/MacOS/python -m pip install nibabel
or
/Applications/Spyder.app/Contents/MacOS/python -m pip3 install nibabel
will solve your problem
Thanks for asking the question.
Have tried conda install
Since we are in anaconda dev env.
If you are using windows
Windows: Click Start, search, or select Anaconda Prompt from the menu
and use that terminal
please find the reference
https://docs.anaconda.com/anaconda/install/verify-install/
I am just starting in python and am trying to experiment with cv2, but whenever I try to import it I get the same error:
Import "cv2" could not be resolved
I have tried every possible way of installing it, I have tried
sys.path.append('/usr/local/lib/python39/site-packages)
which I've seen on one of the posts, I have also swapped between versions (tried 3.7). When I try it in pycharm, and I hover ower it because it gives me an error and an option to install it where I get an error named
Non-zero exit code (2)
Pycharm image:
Vscode image:
You're using wrong command to install the library. Always check the command on a website with corresponding package documentation like this one: https://pypi.org/project/opencv-python/
So the command you need will be
pip install opencv-python
if this still doesn't work, try different variations:
pip3 install opencv-python
or
python -m pip install opencv-python
I started having this issue a while ago, when I used pip to install new things. Every time I try to use pip, my command line says: failed to create process. I have checked the system PATH for my Python folder and it seems to be correct. I have tried uninstalling and reinstalling pip several times. I reinstalled Python as well.
Pip commands do work when I put the full path to pip in the command, but I would rather just type pip whatever than pip "C:/path to it" or whatever. Anyone got any fixes or ideas?
I have checked other places where this was answered, and none of the suggestions helped.
Try this & again check path in environment
python -m pip install --upgrade pip --force-reinstall
Even after downloading the library pyttsx3 it cannot import. It says: lmodule not found error.
I tried all the methods available as:
using pipenv
upgrading pip
But I am still dealing with same problem:
This happened to me as well, what I did is reinstall python to the newest version, once I had it I installed it using pip3 install pyttsx3, and it solved the problem for me.
(note that I'm using pip3 because I' using python3 for my project, it shouldn't cause problem to use pip but just to make sure)
Try download whl file of pyttsx3 from here.
For example download it to F:/file.
Then use pip install F:/file/pyttsx3-2.90-py3-none-any.whl to install.
The problem with pyttsx3 is that it does not work for python version 3.4,3.5,3.6
But it works for python 3.8 and above but in the documentation, it is mentioned it works woth any python above version 3+
Any time i try to install anything with pip i would get this type of error. I've updated my computer, updated visual studios, pip 20.0.2, python 3.8.2, and still nothing works, I've even tried reinstalling everything.
ERROR: https://i.stack.imgur.com/m8Yqv.png
You need to install PortAudio on your system to use one of the libraries you're trying to install.
try using pip3 instead of pip or check paths