-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
yolo:latest image opencv waiting "xcb" code error? #12935
Comments
Hello 👋, It seems like there's an issue with OpenCV trying to open a display window in an environment where it can't find a display (common in Docker containers or headless servers). A quick solution is to use OpenCV in a headless mode which doesn't require a GUI for display. For displaying images, you can write them to a file instead of trying to display them in a window. Replace your display code: cv2.imshow('title', exampleImg) With a file write operation: cv2.imwrite('output.jpg', exampleImg) This change will save the image as If your application strictly requires displaying images in a window and you're working in a GUI-capable environment, ensure that your OpenCV installation includes GUI support (often missing in minimal or server OpenCV builds) and that your environment has access to a display. In some cases, setting the If you're still encountering difficulties, consider checking your environment's compatibility with graphical applications or explore alternatives for visual output. Hope this helps, and thank you for contributing to the YOLOv5 community! 🚀 |
hello @glenn-jocher xorg from docker, how. Do you use it? apt-get -y install xorg xrdp xserver-xorg mesa-utils xauth gdm3 root@331adcd46e1a:/Download#xhost +local:root how. can`t i call you and use it? |
Hello! 👋 Configuring Xorg for Docker can be a bit tricky, especially for GUI applications. Typically, you would need to set the Here's a more straightforward approach you might want to try, focused on sharing the host's display with a Docker container:
Please make sure you understand the security implications of If you're still facing issues, running graphical applications in Docker might require a more detailed setup based on your specific environment. The steps above should work for most Linux host environments, but the exact setup can vary. Let me know if this helps or if you have any more questions! 🚀 |
hello @glenn-jocher DISPLAY does not appear. What could be the reason? We proceeded as follows. The screen doesn't come up. "run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY" Even with this command, the screen is not displayed. Is there anything else I need to do after installing xorg? #> podman run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY docker.io/rurusungoa/php-apache:yolotest #> podman ps -a podman exec -it suspicious_haibt /bin/bash root@a21824545289:/usr/src/app# echo $DISPLAY |
@rurusungoa hello! 👋 It seems like the issue might stem from the way Try setting the podman run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0 docker.io/rurusungoa/php-apache:yolotest If that does not work, ensure that your X server on the host is configured to allow connections from Docker (or Podman) containers. Running Lastly, remember that environment variables and certain configurations might not persist across Let us know if this helps or if you encounter any more issues! 🚀 |
@glenn-jocher hello Even if you try reinstalling with docker instead of podman, it's the same. I don't know what to do. hmm. (T.T) It’s hard and my head hurts. [root@nfs ~]# echo $DISPLAY [root@nfs ~]# docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=12.0 docker.io/rurusungoa/php-apache:yolotest root@38029bf63564:/usr/src/app# echo $DISPLAY root@38029bf63564:/usr/src/app# xhost + root@38029bf63564:/usr/src/app# xhost +local:docker root@d1319f36baf7:/etc/ssh# python
qt.qpa.xcb: could not connect to display localhost:12.0 Available platform plugins are: xcb. Aborted (core dumped) |
@rurusungoa hello 👋, It seems the issue arises because your Docker container cannot correctly communicate with the X server due to the Your host's docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=localhost:12.0 docker.io/rurusungoa/php-apache:yolotest Also, regarding the use of NVIDIA GPUs with Docker, ensure you have NVIDIA Docker toolkit installed and use the docker run --gpus all -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=localhost:12.0 docker.io/rurusungoa/php-apache:yolotest Make sure your X server allows connections from your Docker container. You might need to run Lastly, if graphics rendering or GPU acceleration is involved, the Qt platform issue hints at a deeper integration problem with the graphical environment—in this case, considering running GUI applications in Docker might require ensuring that all dependencies (including graphical drivers and libraries) are correctly set up in your container. Hope this direction helps alleviate the headache a bit! Let us know if there's more we can do. 🚀 |
hello @glenn-jocher I tried using localhost:10.0, but it didn't work. Isn't it possible to use display in x11 docker image? Is there anything else I need to check? You should not try to load it from a conda image. I wonder if the reason why I can't load the conda image is because I'm using Putty when connecting to SSH. echo $DISPLAY #docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=localhost:10.0 docker.io/rurusungoa/php-apache:yolotest root@2ec511776ff1:/usr/src/app# echo $DISPLAY root@2ec511776ff1:/usr/src/app# xhost + root@2ec511776ff1:/usr/src/app# xhost +local: |
Hey there! 😊 It looks like you're encountering a classic display issue when trying to use X11 forwarding with Docker, running GUI apps in containers, especially through an SSH connection (like with Putty), can be tricky due to how X11 forwarding is handled. A couple of things to try/check:
In terms of SSH clients, if Putty isn't working as expected with X11 forwarding, you might try another client that supports X11 forwarding more seamlessly in your setup or check the configuration again to ensure everything is correctly set. Let's keep the exploration going, and don't hesitate to share any updates on your progress! |
hello @glenn-jocher The same phenomenon occurs even if you set "Enable X11 forwarding" in Putty and open it as instructed. systemctl restart sshd As displayed, the symptoms are the same. [root@localhost ~]# xhost I also added the xhost + inet:192.168.0.1 command gate and the server IP accessing Windows, but it is the same. My head hurts so much. Was xhost the reason why my head hurt so much? |
Hey there! 😊 It seems like you've been through quite the ordeal with X11 forwarding. Configuring X11 through SSH, especially with Putty, can indeed be a bit of a headache. Given everything you've tried, here's a quick suggestion: Ensure that the echo $DISPLAY This should return something like docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY your_image_name If Also, If you're still stuck, perhaps revisiting the configuration of your X server (like Xming or VcXsrv on Windows) and ensuring it's set to allow connections from the network might help. X11 and SSH can be a bit tricky 🤯, but you're on the right track. Take a deep breath, and let's tackle this one step at a time! |
hello @glenn-jocher thanks. The first solution that made my headache go away was echo $DISPLAY. When running Putty, I tried to use "localhost:10.0" and the screen did not appear properly. But this time, the error in jupyter notebook. Can you give me an answer? import cv2 When entering "cv2.imshow", a kernel error occurs as shown below. Kernel Restarting It is the same even if you change "NotebookApp.max_buffer_size" in jupyter-notebook. #> cd /root/.jupyter #> vim jupyter_notebook_config.py c.NotebookApp.max_buffer_size = 536870912 I was wondering if it was a memory problem, so I ran "free -mh" and there was 10GB free, so it didn't seem to be a problem. Could you tell me which part I need to check more? |
Hey there! 😊 Great to hear that figuring out the Regarding the problem you're encountering with A common workaround is to use Jupyter Notebook's capabilities to display images directly in the notebook interface. Here's how you can do it: from IPython.display import display, Image
import cv2
# Read the image using OpenCV
img = cv2.imread('/Download/123.jpg')
# Convert the image to RGB (OpenCV uses BGR by default)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# Save the image to a buffer
cv2.imwrite('temp_img.jpg', img_rgb)
# Display the image
display(Image(filename='temp_img.jpg')) This approach avoids the need for Hope this helps, and keeps the headaches at bay! Let me know if there's anything else. |
hello @glenn-jocher thanks. Thank you for always replying. Thank you for your help. As I said, there is a way to the buffer and look at it, but it was possible to check it in another way.
import cv2 Let me know the kick points and share what I learned. This is how I first used it with success. I'm trying to get rid of the headache. thanks. |
Hello @rurusungoa, I'm thrilled to hear that you've found a solution that works for you and appreciate you sharing your findings with the community! 🎉 Your method using Matplotlib is indeed another great way to display images within Jupyter Notebooks or similar environments without relying on The switch from BGR to RGB before displaying the image is crucial when working with OpenCV in conjunction with Matplotlib, as OpenCV uses BGR by default, while Matplotlib expects RGB. Your concise example perfectly illustrates this important step. Here's a compact way to integrate your approach into a single function for future use: import cv2
import matplotlib.pyplot as plt
def display_image(path):
bgr_img = cv2.imread(path)
rgb_img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2RGB)
plt.imshow(rgb_img)
plt.show()
display_image('/Download/123.jpg') This handy function Thanks for sharing your learnings! It's always great to see community members helping each other out. 🙌 If there's anything more you're curious about or need assistance with, feel free to ask! |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Search before asking
Description
Hello.
an error occurred when running opencv with the yolo:latest version.
can you review the information below?
is it possible to process it if i install the package?
python
Python 3.10.9 (main, Mar 8 2023, 10:47:38) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
QFactoryLoader::QFactoryLoader() checking directory path "/opt/conda/lib/python3.10/site-packages/cv2/qt/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/opt/conda/bin" ...
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/2to3"
QElfParser: '/opt/conda/bin/2to3-3.10' is not an ELF object
"'/opt/conda/bin/2to3-3.10' is not an ELF object"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/2to3-3.10"
QElfParser: '/opt/conda/bin/2to3-3.10' is not an ELF object
"'/opt/conda/bin/2to3-3.10' is not an ELF object"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/acountry"
"Failed to extract plugin meta data from '/opt/conda/bin/acountry'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/activate"
QElfParser: '/opt/conda/bin/activate' is not an ELF object
"'/opt/conda/bin/activate' is not an ELF object"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/activate-global-python-argcomplete"
QElfParser: '/opt/conda/bin/activate-global-python-argcomplete' is not an ELF object
"'/opt/conda/bin/activate-global-python-argcomplete' is not an ELF object"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/adig"
"Failed to extract plugin meta data from '/opt/conda/bin/adig'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/ahost"
"Failed to extract plugin meta data from '/opt/conda/bin/ahost'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/asadmin"
QElfParser: '/opt/conda/bin/asadmin' is not an ELF object
"'/opt/conda/bin/asadmin' is not an ELF object"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/asn1Coding"
"Failed to extract plugin meta data from '/opt/conda/bin/asn1Coding'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/asn1Decoding"
"Failed to extract plugin meta data from '/opt/conda/bin/asn1Decoding'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/asn1Parser"
"Failed to extract plugin meta data from '/opt/conda/bin/asn1Parser'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/opt/conda/bin/automat-visualize"
QElfParser: '/opt/conda/bin/automat-visualize' is not an ELF object
"'/opt/conda/bin/automat-visualize' is not an ELF object"
not a plugin
The text was updated successfully, but these errors were encountered: