Comments (26)
sudo apt install libgtk2.0-dev pkg-config
as the prompt says for Ubuntu users -> [Same Error]pip uninstall opencv-python-headless
-> [Other Error]pip uninstall opencv-python; pip install opencv-python
-> [Solved]
Thank you, @hg2051
from opencv-python.
It's because of ''opencv-python-headless'. Uninstall it!
from opencv-python.
I have the same problem too. I did pip uninstall opencv-python-headless and it still does not work.
Same to me, but I do this:
pip uninstall opencv-python
Then:
pip install opencv-python
from opencv-python.
I have the same problem too. I did pip uninstall opencv-python-headless and it still does not work.
from opencv-python.
Tried pip uninstall opencv-python-headless - didn't work
Also, pip uninstall opencv-python; pip install open-python - didn't work
Closed Spyder environment and opened it again - worked! :)
from opencv-python.
ya it is because of pip install OpenCV- python- headless just uninstall it and your error will be sorted
from opencv-python.
Please use Pycharm, it is way easier to manage the packages
from opencv-python.
Solve: Unistall opencv-python-headless
from opencv-python.
@LikhithChakravarthi Hi Addinational Solution :
Use Pycharm,
Install opencv-python and cv2 from the module installation location of the interpreter you will use from the interpreter options in Pycharm.
from opencv-python.
Hay
please try to update the --> { python -m pip install opencv-python --upgrade } <-- in windows
it worked for me.
from opencv-python.
The error you're encountering indicates that the version of OpenCV you're using was built without GUI support for window management. To resolve this issue and display the camera feed in a window, you can either rebuild OpenCV with GUI support or use an alternative library to display the camera feed. Here are two possible solutions:
Solution 1: Rebuild OpenCV with GUI Support (Recommended)
Ensure you have CMake installed on your system.
Rebuild OpenCV with GUI support using CMake. You can do this by following these steps:
Download the OpenCV source code from the official OpenCV website: https://opencv.org/releases/
Extract the downloaded source code archive to a directory.
Open a terminal or command prompt and navigate to the directory where you extracted the OpenCV source code.
Create a build directory within the OpenCV source directory and navigate to it:
Configure the build using CMake with GUI support enabled:
using :
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
After successful configuration, build and install OpenCV:
make
sudo make install
Once the installation is complete, you should have OpenCV with GUI support.
Update your Python environment to use the newly built OpenCV library. You may need to uninstall the previous OpenCV package and install the new one.
from opencv-python.
Duplicate of #17
from opencv-python.
getting same error
please help..
in-advance thank you
from opencv-python.
uninstalled opencv-python-headless and still the same error. I am using Ubuntu.
from opencv-python.
I have tried everything, unistalling opencv-python, contrib modules and reinstalling them and Uninstalling headless module, but not working. Can ayone help me?
from opencv-python.
Hay please try to update the --> { python -m pip install opencv-python --upgrade } <-- in windows it worked for me.
Thanks, it worked for me too=)))
from opencv-python.
if you are using spyder then ...
uninstall the open cv which you have installed by command prompt or anaconda prompt
then install the opencv library using the terminal available in the spyder itself
then try again to run the same code/program using spyder it will run.
from opencv-python.
The error you're encountering indicates that the version of OpenCV you're using was built without GUI support for window management. To resolve this issue and display the camera feed in a window, you can either rebuild OpenCV with GUI support or use an alternative library to display the camera feed. Here are two possible solutions:
Solution 1: Rebuild OpenCV with GUI Support (Recommended)
Ensure you have CMake installed on your system.
Rebuild OpenCV with GUI support using CMake. You can do this by following these steps:
Download the OpenCV source code from the official OpenCV website: https://opencv.org/releases/
Extract the downloaded source code archive to a directory.
Open a terminal or command prompt and navigate to the directory where you extracted the OpenCV source code.
Create a build directory within the OpenCV source directory and navigate to it: Configure the build using CMake with GUI support enabled: using : cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
After successful configuration, build and install OpenCV: make sudo make install
Once the installation is complete, you should have OpenCV with GUI support.
Update your Python environment to use the newly built OpenCV library. You may need to uninstall the previous OpenCV package and install the new one.
To do this but for windows:
After running this command successfully:
"cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON .."
Instead of executing "make" and "sudo make install" as these are bash commands,
In powershell you have to execute these commands in the build directory:
To Build: cmake --build . --config Release
To Install: cmake --build . --target INSTALL
Now uninstall and then reinstall "opencv-python" using pip.
Done!
from opencv-python.
pip uninstall opencv-python; pip install opencv-python Solved by pycharm
from opencv-python.
On Ubuntu, this work for me:
sudo apt-get install python3-opencv
from opencv-python.
Hay please try to update the --> { python -m pip install opencv-python --upgrade } <-- in windows it worked for me.
ugprading to a newer version solved the issue for me ( opencv 4.9.0)
from opencv-python.
@skvark
@hzx829
@nofreewill42
@hzx829
# apt install libgtk2.0-dev pkg-config
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libgl1-mesa-glx : Depends: libgl1 but it is not going to be installed
Depends: libglx-mesa0 but it is not going to be installed
libgtk2.0-dev : Depends: libgtk2.0-0 (= 2.24.32-4ubuntu4) but it is not going to be installed
Depends: gir1.2-gtk-2.0 (= 2.24.32-4ubuntu4) but it is not going to be installed
Depends: libgtk2.0-common but it is not going to be installed
Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed
Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed
Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
Depends: libatk1.0-dev (>= 1.29.2) but it is not going to be installed
Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
Depends: libx11-dev (>= 2:1.0.0-6) but it is not going to be installed
Depends: libxext-dev (>= 1:1.0.1-2) but it is not going to be installed
Depends: libxinerama-dev (>= 1:1.0.1-4.1) but it is not going to be installed
Depends: libxi-dev (>= 1:1.0.1-4) but it is not going to be installed
Depends: libxrandr-dev (>= 2:1.2.99) but it is not going to be installed
Depends: libxcursor-dev but it is not going to be installed
Depends: libxfixes-dev (>= 1:3.0.0-3) but it is not going to be installed
Depends: libxcomposite-dev (>= 1:0.2.0-3) but it is not going to be installed
Depends: libxdamage-dev (>= 1:1.0.1-3) but it is not going to be installed
Depends: libxml2-utils but it is not going to be installed
Recommends: debhelper but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
import cv2
image = cv2.imread("1.jpg")
cv2.imshow("image", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
When I connect to the server remotely using pycharm, I want a local visualization
I have encountered this problem, I would like to ask you how to solve it?
https://stackoverflow.com/questions/64784315/qt-qpa-xcb-could-not-connect-to-displayerror-while-using-opencv-on-ec2-ubuntu-s: In my past experience, pycharm can do local visualization, but sometimes it will go wrong, is this related to the pycharm version or is it related to the remote server
from opencv-python.
It's because of ''opencv-python-headless'. Uninstall it!
Hie , I have uninstall opencv-headless but upon uninstalling that I am unable to import opencv
ModuleNotFoundError: No module named 'cv2'
(upon uninstalling opencv-headless)
And if I reinstall opencv (with opencv-headless) , it is imported but stuck in same error
from opencv-python.
Did uninstall then re-install opencv-python and it worked for me.
before:
- opencv-python==4.8.0.74
- opencv-python-headless==4.9.0.80
after:
- opencv-python==4.9.0.80
- opencv-python-headless==4.9.0.80
So I guess this error can be caused by mismatched versions of opencv-python and opencv-python-headless.
from opencv-python.
If you are using Pycharm, just simply change the interpreter and try to run your application again. It solves my problem relating with this error.
from opencv-python.
Uninstalling the opencv-python and then reinstalling it worked for me
from opencv-python.
Related Issues (20)
- PyPI: macOS arm64 wheel missing
- cv2.createThinPlateSplineShapeTransformer not exist in 4.10
- imdecode jpeg2000 segfault or deadlock in multithreading HOT 2
- Typing of compare does not allow scalar for src1 or src2
- Why Building wheel for opencv-python when using "pip install opencv-python"
- Typing stubs generation has failed when building wheel HOT 1
- error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'
- Gstreamer support on windows 10
- why ı am getting this error
- BUG: cv2.fillPoly() causing segmentation fault on Ubuntu 22.04.4 LTS HOT 1
- [Suggestion] Metapackage as solution to current issues with opencv as dependency HOT 1
- Build from source python 3.12 fails HOT 6
- error: OpenCV(4.8.0) /io/opencv/modules/core/src/copy.cpp:71: error: (-215:Assertion failed) cn <= 4 in function 'scalarToRawData'
- ModuleNotFoundError: No module named 'distutils' in latest release HOT 7
- MacOS arm64 wheels missing from PyPI 4.10 release HOT 2
- ImportError: numpy.core.multiarray --- Numpy 2.0.0 HOT 1
- cv2/cv2.abi3.so, 2): Library not loaded: /usr/local/opt/libunistring/lib/libunistring.2.dylib Referenced from: /usr/local/opt/gnutls/lib/libgnutls.30.dylib HOT 1
- When will opencv-python support numpy 2.0? HOT 6
- compile bug
- AttributeError: module 'numpy' has no attribute 'object'. `np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-python.