When I am running the command from cv2.ximgproc import guidedFilter, I am getting an error: ModuleNotFoundError: No module named 'cv2.ximgproc'
I searched the Internet for possible reasons, and I found out that I should run a command pip install opencv--contrib-python on the terminal, which I did. Even after doing that, I am getting the same error.
Please note that I am not very good at programming and technical stuff, so please explain in simple terms. I have a mac, and I am using Anaconda for writing my codes.
You need to uninstall the regular opencv package first.
First uninstall both regular opencv as well as contrib package:
pip uninstall opencv-python
pip uninstall opencv-contrib-python
Then install the contrib package:
pip install opencv-contrib-python
You can refer to this post for more information:
Module 'cv2.cv2' has no attribute 'ximgproc'
I have written a python script as follows:
from cv2.ximgproc import guidedFilter
print("hello")
Initially it was giving me the same error : 'ModuleNotFoundError: No module named 'cv2.ximgproc'. But then i ran the command "pip install opencv--contrib-python" and after that it prints "hello" i.e it is detecting the ximgproc module.
please check the below screenshot.
Check once the installation of opencv--contrib module. There is some problem at that stage.
Related
I have installed the oct2py package using the pip command pip install oct2py, set the environement path of python, pip and octave as in the following picture:
However, whenever I try to import it in my python script, I get the following error:
I checked whether the package is installed, it says: Requirement satisfied.
Any ideas of what I could possibly be doing wrong?
I would like to preface with the fact that I am a coding newbie and all this is very new to me. In fact, this is my first stack overflow question.
Anyways I am learning python and am trying to install my first third party module called “pyperclip” in Terminal, but I don't think it installed correctly. I am very new with Terminal as well.
For reference, I am following the youtube guide "Automate the Boring Stuff with Python"
https://www.youtube.com/watch?v=xJLj6fWfw6k
I am on Lesson 8 and I am at minute 3:43 in the video if you want to follow along.
Here are some of my system details:
Mac OS X
Python version 3.8.3
I ran the following into Terminal:
sudo pip3 install pyperclip
Then I received the following message in Terminal after installing pyperclip
The directory or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
I then tried to install again using the following:
sudo -H pip3 install pyperclip
Then I got this message:
Requirement already satisfied: pyperclip in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.8.0)
I tried installing one last time using:
pip3 install pyperclip
I got the same message again:
Requirement already satisfied: pyperclip in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.8.0)
This is also the error I get when I try importing pyperclip in my interactive shell:
>>> import pyperclip
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ModuleNotFoundError: No module named ‘pyperclip’
>>>
Can anyone help me please? I feel like a fish out of the water with all this stuff. Especially when it comes to Terminal. Any help would be greatly appreciated.
I wanted to discuss a few things that might help you on your way.
We typically do not use sudo in conjunction with pip to install Python packages. This installs the package at a system level and could conflict with packages that your system currently has installed or may install packages to a Python installation which is different than the one you are using from the terminal. Instead, we typically use pip install --user rather than sudo pip install.
See this question and answer for more: sudo pip install VS pip install --user.
If you are ever unsure whether a package has been installed properly, check using
pip3 list
We also need to make sure that the Python interpreter you are using is the same as where pip is installing. Since you are using pip3 to install, you should be using python3 at the terminal to enter the interactive shell. You can also verify that you are using the right Python interpreter by typing in the following command into the terminal:
which python3
Then, make sure that the output matches with the /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ path that was reported by pip3.
If you are using a different interactive shell such as ipython, you need to make sure that you install ipython in the same manner using
pip3 install --user ipython
and executing it using
ipython3
Try repeating your steps using this new information to see if it helps. Let me know if you have any more questions or need some more help.
I need to use from kneed import KneeLocator for Knee-point detection in Python, but everytime I try to import the module after closing the Jupyter notebook I always get ModuleNotFoundError: No module named 'kneed' error and I am forced to install it again. I am using Jupyter Notebook with Anaconda on a remote server that I do not have the access to. I am using its web client.
The module I am trying to install and use is from https://github.com/arvkevi/kneed
I have not faced this issue with any other libraries. All other libraries I just need to install just once.
What could be the reason behind that?
Could anybody help me understand why is it happening and how to solve this issue?
You might need to run this line of code first. That worked for me
!pip install --upgrade kneed
According the information you provide, you are using python3.X . try "python3 setup.py install" instead of "python setup.py install".
After you install the module, run python3 -c "help('help;)" to confirm you install the module successfully.
in my Python Script there is an ERROR with the line
import win32events
I still installed the package pypiwin32 (with pip install pypiwin32) but it seems that this is nor the right package.
Does someone know what I need to install to use win32events in Python?
You should install pywin32 package (not pypiwin32)!!!
Using the Mac Os Terminal, I downloaded the Jupyter lightning module using "pip install lightning-python" in the /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages directory.
However, when I try to import it, I get the error, No module named 'lightning'
and when I list out the files in the site-packages directory, the module doesn't appear.
You are getting the error because you used pip. pip basically is for version 2 of python. for using it for pip3, you should first install pip3 package. Then copy all your dependencies to python3 libraries.
Hope that answers the question.