Skip to content

qt.qpa.xcb: could not connect to display #287

Description

@LukeLIN-web
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/user1/CoppeliaSim" 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb. Aborted (core dumped)

I install from offical website https://downloads.coppeliarobotics.com/V4_1_0/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz instead of wget https://downloads.coppeliarobotics.com/V4_1_0/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz But it should be same.

and install pyrep

For headless server, it is diffcult.

I did

echo "export COPPELIASIM_ROOT=/openpi/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04" >> ~/.bashrc; 
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$COPPELIASIM_ROOT" >> ~/.bashrc;
echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\$COPPELIASIM_ROOT" >> ~/.bashrc;

I also tried

#!/bin/bash

export DISPLAY=:99
export QT_QPA_PLATFORM=xcb  
export QT_X11_NO_MITSHM=1


python try.py

try.py is following:

import numpy as np
from rlbench.action_modes.action_mode import MoveArmThenGripper
from rlbench.action_modes.arm_action_modes import JointVelocity
from rlbench.action_modes.gripper_action_modes import Discrete
from rlbench.environment import Environment
from rlbench.tasks import FS10_V1

action_mode = MoveArmThenGripper(
  arm_action_mode=JointVelocity(),
  gripper_action_mode=Discrete()
)
env = Environment(action_mode, headless=True)
env.launch()

train_tasks = FS10_V1['train']
test_tasks = FS10_V1['test']
task_to_train = np.random.choice(train_tasks, 1)[0]
task = env.get_task(task_to_train)
task.sample_variation()  # random variation
descriptions, obs = task.reset()
obs, reward, terminate = task.step(np.random.normal(size=env.action_shape))

this can works

#!/bin/bash
COPPELIA_QT=$(find /home/user1/openpi/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04/ -name "platforms" -type d | head -1)
COPPELIA_PLUGINS=$(dirname "$COPPELIA_QT")


echo "export QT_PLUGIN_PATH=\"$COPPELIA_PLUGINS\""
echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\"$COPPELIA_QT\""

export QT_PLUGIN_PATH=$COPPELIA_PLUGINS
export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIA_QT
export PYOPENGL_PLATFORM="osmesa"
export DISPLAY=":99"
export COPPELIASIM_ROOT=/home/user1/workspace/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04
export LD_LIBRARY_PATH=$COPPELIASIM_ROOT:$LD_LIBRARY_PATH

Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
XVFB_PID=$!
sleep 2

trap "kill $XVFB_PID 2>/dev/null" EXIT
python main.py --args.task_name close_jar --args.num_trials 5 --args.headless

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions