Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cv2.imshow "The function is not implemented. Rebuild the library" #18

Closed
Crescent-Saturn opened this issue Dec 8, 2016 · 26 comments
Closed

Comments

@Crescent-Saturn
Copy link

Crescent-Saturn commented Dec 8, 2016

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /io/opencv/modules/highgui/src/window.cpp, line 545

please, OpenCV version :3.1.0
Python version: 2.7.12
OS: Elementary OS Loki.

Thanks!

@skvark
Copy link
Member

skvark commented Dec 8, 2016

Duplicate of #17

@skvark skvark closed this as completed Dec 8, 2016
@hprasad98
Copy link

getting same error
please help..
in-advance thank you

@hg2051
Copy link

hg2051 commented Dec 30, 2020

It's because of ''opencv-python-headless'. Uninstall it!

@Mayur8991
Copy link

ya it is because of pip install OpenCV- python- headless just uninstall it and your error will be sorted

@dwaynemcfarlane
Copy link

uninstalled opencv-python-headless and still the same error. I am using Ubuntu.

@nofreewill42
Copy link

nofreewill42 commented Sep 28, 2021

  1. sudo apt install libgtk2.0-dev pkg-config as the prompt says for Ubuntu users -> [Same Error]
  2. pip uninstall opencv-python-headless -> [Other Error]
  3. pip uninstall opencv-python; pip install opencv-python -> [Solved]

Thank you, @hg2051

@Yuvaldavid
Copy link

I have the same problem too. I did pip uninstall opencv-python-headless and it still does not work.

@Kitty1122
Copy link

Kitty1122 commented May 24, 2022

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! :)

@TracyLoza
Copy link

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

@bkaan99
Copy link

bkaan99 commented Oct 31, 2022

Solve: Unistall opencv-python-headless

@LikhithChakravarthi
Copy link

I have tried everything, unistalling opencv-python, contrib modules and reinstalling them and Uninstalling headless module, but not working. Can ayone help me?

@bkaan99
Copy link

bkaan99 commented Feb 18, 2023

@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.

@obensustam2
Copy link

Please use Pycharm, it is way easier to manage the packages

@venkat1230
Copy link

Hay
please try to update the --> { python -m pip install opencv-python --upgrade } <-- in windows
it worked for me.

@Sellouk
Copy link

Sellouk commented Sep 21, 2023

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.

@Lelouch2503
Copy link

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=)))

@vivekmorariya
Copy link

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.

@VanshRana12
Copy link

VanshRana12 commented Nov 29, 2023

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!

@tegarpf90
Copy link

pip uninstall opencv-python; pip install opencv-python Solved by pycharm

@hzx829
Copy link

hzx829 commented Jan 21, 2024

On Ubuntu, this work for me:

sudo apt-get install python3-opencv

@oussamaJMAA
Copy link

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)

@DAVID-Hown
Copy link

DAVID-Hown commented Mar 17, 2024

@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

@jmhasan1
Copy link

jmhasan1 commented Mar 25, 2024

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

@c2727c
Copy link

c2727c commented May 1, 2024

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.

@dineth88
Copy link

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.

@haileyesus34
Copy link

Uninstalling the opencv-python and then reinstalling it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests