问题描述
我希望x11转发能够在Google Colab上工作.我使用的是Windows 10计算机,可在文章底部找到Google Colab OS信息.这是我进行测试的方法:
- 安装
检查
- Google Colab不会在代码单元之间保留环境变量.因此,您应该为每个变量设置DISPLAY变量.
- Xming可能不允许将远程连接作为默认设置.至少,VcXsrv可以做到这一点.尝试禁用访问控制.这是一个不安全的选择.
- 路由器和防火墙必须打开6000 + n/tcp端口.n是从0开始计数的显示编号(例如,主机名:0.0→n = 0)
I was hoping to get x11 forwarding to work on Google Colab. I am using a Windows 10 machine and the Google Colab OS information can be found at the bottom of the post. Here's what I did to test it out:
- Installed Xming and ran it.
Made a new IPython notebook in Google Colab and installed x11 apps successfully using
!sudo apt-get install x11-apps
Set my display to be my IP address using
!export DISPLAY=<my-ip-address>
Run
!xeyes
. I get an error message sayingError: Can't open display:
I'm not sure if this is a problem of using the correct DISPLAY setting, running x11 forwarding through Google Colab or both!Can anyone help me out? Thank you!
The relevant parts of the output of when I run
!cat /etc/os-release
on my Google Colab notebook.NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian VERSION_ID="18.04" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic
解决方案tl;dr
- Open 6000/tcp port on your router and firewall
- Install VcXsrv
- Run "XLaunch" with "Disable access control"
- Run "!apt-get install x11-apps && export DISPLAY=YOUR_IP_ADDRESS:0.0 && eyes" on Colab
Check
- Google Colab does not keep environment variables across code cells. So you should set DISPLAY variable each them.
- Xming may disallow remote connection as a default setting. At least, VcXsrv do that. Try to disable access control. This is an insecure option.
- Router and firewall must open 6000+n/tcp port. The n is display number counting from 0. (e.g. HOSTNAME:0.0 → n=0)Open Port Check Tool - Test Port Forwarding on Your Router
这篇关于通过Google Colab进行x11转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!