-
-
Notifications
You must be signed in to change notification settings - Fork 228
Frequently Asked Questions
I don't know why, but sometimes colab disconnects after running a cell about 5 minutes. Please try following Python code on new cell on google colab without running remocolab. It prints elapsed time every 10 seconds.
import time
begin = time.time()
for i in range(30 * 6):
time.sleep(10)
print(time.time() - begin)
If you get disconnected within 10 minutes, it is the problem of google colab, not remocolab. If colab didn't disconnected when running above code but disconnected when running remocolab, please report the issue.
You don't need to do that if you use Argo Tunnel instead of ngrok. Read README.md for more details.
ngrok token must be kept secret. If you can specify ngrok token to remocolab.setupSSHD() or remocolab.setupVNC(), you can save ngrok token to a notebook. Then, you might forget that your notebook contains it and share the notebook. I don't know how to skip it without risking a security.
Settting ServerAliveInterval
ssh client option to some value might keep ssh connection alive.
You can add -o ServerAliveInterval=60
option to the SSH command or edit ssh config file.
For more details:
https://unix.stackexchange.com/questions/3026/what-options-serveraliveinterval-and-clientaliveinterval-in-sshd-config-exac
- If you are using Windows 10 or Windows Server 2019, you can use OpenSSH in Windows.
- You can also install ssh using scoop package manager.
scoop install openssh
By using public key authentication, you can login to ssh server without copy&pasting a password: https://github.com/demotomohiro/remocolab#how-to-use
You can login as root using public key authentication:
https://github.com/demotomohiro/remocolab#how-to-setup-public-key-authentication-for-root-login
Or use su
or sudo
command.
When you got error and want to rerun remocolab.setupVNC()
or remocolab.setupSSHD()
, you need to do factory reset runtime
before rerun the command.
As you can run only 1 ngrok process with free ngrok account, running remocolab.setupVNC/setupSSHD
will fail if there is another instace that already ran remocolab.
In that case, terminate another instance from Manage sessions
screen.
You need to run the ssh command displayed by remocolab and login to the server to make local port forwarding.
remocolab.setupVNC()
show 2 VNC passwords and second one is view only password.
For example:
VNC password: xxxxxxxx
VNC view only password: yyyyyyyy
You can control the destkop if you login to VNC with first VNC password. If you use second password to login, you can see the destkop but cannot control the desktop.
remocolab can use only ngrok and Argo Tunnel without modifying code. I wrote a code that setup SSH server and uses serveo. https://github.com/demotomohiro/Google-Colaboratory-SSH-samples/blob/master/src/ssh_serveo.ipynb
You can install softwares by adding install commands after remocolab.setupVNC()
or remocolab.setupSSHD()
.
For example:
!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupVNC()
#Install anything you want quietly
!apt-get install -qq -o=Dpkg::Use-Pty=0 neovim tmux > /dev/null
#Run commands as colab user
import pathlib, subprocess
pathlib.Path("prepair.py").write_text("""\
import pathlib
from subprocess import run
run(["git", "clone", "https://github.com/nim-lang/Nim.git"], cwd = pathlib.Path.home())
run(["sh", "build_all.sh"], cwd = pathlib.Path.home() / "Nim")
""")
subprocess.run(
["su", "-c", "python3 prepair.py", "colab"],
check = True)
-
Open TurboVNC Viewer Options and change Encoding method to
Tight + Medium-Quality JPEG
orTight + Low-Quality JPEG(WAN)
. -
Try different ngrok region
- Usually closest one is lowest latency but it can be not always true.
Following methods require changing remocolab's code.
- Find ngrok alternative that is faster than ngrok.
You will find web sites that explains these services when you google "ngrok alternative". You need to modify some code in remocolab to use it.
- Run your own ngrokd server.
https://github.com/inconshreveable/ngrok/blob/master/docs/SELFHOSTING.md
- Buy Google Cloud, AWS, Azure or other cloud servers and setup VNC on it
You will get less lag because you can access them without ngrok. remocolab doesn't work on them because it is designed to work only for Google colab. Setup ssh or VNC would be not hard without scripts like remocolab.
service ssh restart
Open TurboVNC Viewer Options, click Connection tab and set Remote desktop size.