cannot connect to X server error showed up in GCP - python-2.7

I create a python GUI by PyQt4, and now I'm trying to save this program into Google Cloud Platform(Compute engine) so that I can remotely execute it. But after I execute my python program, there's a problem showed up, the console showed the message :"cannot connect to X server". I also try to run with "xvfb-run python GUI.py", although it started to run but the graphical user interface didn't showed up, is there any suggestion? Thanks in advance!

In order to run a GUI application remotely on a Linux/Unix box, you need to have a X server running on your local machine and ready to accept a connection. Easiest way to do this is to SSH in and enable X11Forwarding either in your client config, your personal version of the client config, or on the command line (ie, the -X or -Y options).
Us Linux folks already have an X server, as do them BSD folks. Mac users can install it and it integrates quite nicely on OS X. Windows users need to either pay some $ and buy a license for a commercial product, or use cygwin-x.

Related

How to run a virtual desktop and access it using Google Cloud Free Tier

I need a virtual desktop to access chrome on the go via the Chrome Remote Desktop app on IOS.
The virtual desktop should be the usual GUI where I can open / install programs like a normal PC.
I know Windows is not free hence I am stuck with linux.
I created account and I know I need to create an instance.
What instance? How to get GUI? How to setup and access using Chrome Remote Desktop? Etc
Totally clueless.
What I Did:
1) I installed a Ubantu instance with a disk space of 30G.
2) I went into the shell and tried to run commands for installing a standard GUI.
sudo apt-get install ubuntu-desktop
3) Immediately received errors of missing dependencies.

Programming the Pepper robot without "Choreography" software?

Usually the developer can use Softbanks own software Choreography to give programs to Pepper robot.
Isn't there a way to setup a different development environment? e.g. Access via SSH and creating Python scripts with a simple text editor and starting the script manually? It means writing and starting Python scripts for Pepper without using Choreography.
You can also use qibuild (pip install qibuild) : https://github.com/aldebaran/qibuild
It contains a qipkg command, just run
qipkg deploy-package path/to/your/file.pml --url USER#IP:/home/nao
A pml file is a project, it is created by Choregraph, or you can use this tool :
https://github.com/pepperhacking/robot-jumpstarter
in order to get a sample app.
Of course, using Choregraphe is not an obligation, you can use the different SDKs directly.
You can for instance create a python script on your computer, copy it on the robot
scp path/to/script/myscript.py nao#robotIp
And then ssh onto the robot and launch the script
ssh nao#robotIp
python myscript.py
You can also ssh onto the robot, create a script (using nano for instance) and launch it from there.
I've been using Pycharm Pro for 6 months and I am happy with it. You get automatic deployment and remote debugging. The most basic setup must still be done with Choregraphe, but it takes less than one minut.

Spring Tool Suite crashes on virtual OS X

I'm trying to get Spring Tool Suite (STS) running on a virtual OS X machine (VMWare 8.0.2) on a iMac host. The virtual OS X machine is the latest OS X: 10.11.2 and is a clean install with just NetBeans 8.1 (with JDK8 Java 1.8). NetBeans works flawlessly.
STS gets the startup splash, it loads the framework and I get to see the interface for approx. 1 second, then I get the "Spring Tool Suite quit unexpectedly"
I've tried STS 3.7.2 and 3.7.1, both have exactly the same problem. I've tried the copy that works native on my host iMac, that too gave the same problem.
Anyone familiar with this problem? Google gives me no results. Would it be impossible to run STS on a Virtual Machine?
I could post the dump from OS X but that would be a lot of text, please let me know if that would be helpful?
Thanks in advance!
STS Dumpfile (Dropbox)
There are at least two ways you could try to work around this problem.
1) run STS with a JDK7 at least once. JavaFx is not supported with JDK7 and STS will automatically fallback on using the old dashboard. This should allow you to launch STS succesfully. You can then change the preference here: "Preferences >> Spring >> Dashboard" to always use the old dashboard. Then go back to running with JDK8 if you wish.
2) Alternatively you can 'hack' the metadata in the workspace to set the preference to use the old dashboard (use this method if the above one seems too onerous, maybe you don't have a old JDK handy)
The metadata file you want to edit is this one (from the root of workspace folder):
.metadata/
.plugins/
org.eclipse.core.runtime/
.settings/
org.springsource.ide.eclipse.dashboard.ui.prefs
If the file doesn't exist, create it and add these two line:
eclipse.preferences.version=1
org.springsource.ide.eclipse.dashboard.uidashboard.use.old=true
If the file exists you only need to add (or change) this line:
org.springsource.ide.eclipse.dashboard.uidashboard.use.old=true
STS was keep crashing on my macos machine so I had to install every time
so I came up with a solution :
cd $HOME
sudo codesign --force --deep --sign - /Applications/SpringToolSuite4.app

Running Python GUI apps on C9.io

Does anyone know if it is possible to run python-gui apps, like wxPython, on a c9.io remote server? I have my home server set up with c9 via SSH, and no issues logging in and running apps in the terminal on the VM. However, when I try to run GUI apps, I get the following error message.
Unable to access the X Display, is $DISPLAY set properly?
After searching and searching, I can't seem to find a guide or anything in the docs that detail how to set $DISPLAY in the script. X display is installed and active on my server, but I don't know how to configure the c9 script to access it properly. Any assistance would be appreciated!
I don't know if Cloud9 supports it but normally to run a remote GUI application you would have ssh forward the X11 communication over the ssh connection via a tunnel. So basically the application is running on the remote system and it is communicating with a local X11 server which provides you with the display and handling of the mouse and keyboard.
If you run ssh with the -X parameter then it will attempt to set up the X11 tunnel and set $DISPLAY in the remote shell so any GUI applications you run there will know how to connect to the X11 tunnel. Bw aware however that this is something that can be turned off on the remote end, so ultimately it is up to Cloud9 whether they will allow you to do this.

Understanding fabric

I've just stumbled upon Fabric and the documentation doesn't really make it obvious how it works.
My educated guess is that you need to install it on both client-side and server-side. The Python code is stored on the client side and transferred through Fabric's wire-protocol when the command is run. The server accepts connections using the OpenSSH SSH daemon through the ~/.ssh/authorized_keys file for the current user (or a special user, or specified in the host name to the fab command).
Is any of this correct? If not, how does it work?
From the docs:
Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.
It provides a basic suite of operations for executing local or remote shell commands (normally or via sudo) and uploading/downloading files, as well as auxiliary functionality such as prompting the running user for input, or aborting execution.
So it's just like ssh'ing into a box and running the commands you've put into run()/sudo().
There is no transfer of code, so you only need to have ssh running on the remote machine and have some sort of shell (bash is assumed by default).
If you want remote access to a python interpreter you're more looking at something like execnet.
If you want more information on how execution on the remote machine(s) work look to this section of the docs.
Most what you are saying is correct, except that the "fabfile.py" file only has to be stored on your client. An SSH server like OpenSSH needs to be installed on your server and an SSH client needs to be installed on your client.
Fabric then logs into one or more servers in turn and executes the shell commands defined in "fabfile.py". If you are located in the same dir as "fabfile.py" you can go "fab --list" to see a list of available commands and then "fab [COMMAND_NAME]" to execute a command.
The user on the server does not need to be added to "~/.ssh/authorized_keys" but if it is you don't have to type the password every time you want to execute a command.